home *** CD-ROM | disk | FTP | other *** search
/ Computer Inter@ctive 17 / Computer Interactive cdrom 17 - gen 99.iso / ZDNETIT / CONTENT / CMATHW16.ZIP / INCLUDE.ZIP < prev    next >
PKZip Archive  |  1998-10-21  |  109.8 KB

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: PKZip Archive (archive/zip).

ConfidenceProgramDetectionMatch TypeSupport
100% dexvert PKZip Archive (archive/zip) magic Supported
100% file Zip archive data, made by v2.0, extract using at least v1.0, last modified, last modified Sun, Oct 21 1998 01:25:00, uncompressed size 1793, method=store default
99% file Zip archive, with extra data prepended default
98% file data default
100% TrID ZIP compressed archive default
100% dexmagic PrintFox/Pagefox WEAK default
100% siegfried x-fmt/263 ZIP Format default
100% lsar Zip default
100% gt2 ZIP Archiv gefunden (Auflistung ist deaktiviert) default
100% detectItEasy Archive: Zip(1.0)[100.0%,5 files] default
100% binwalkID Zip archive data, at least v1.0 to extract, compressed size: 1793, uncompressed size: 1793, name: CMATH.H default
100% xdgMime application/zip default



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 50 4b 03 04 0a 00 00 00 | 00 00 20 0b 55 25 58 e9 |PK......|.. .U%X.|
|00000010| 6f ad 01 07 00 00 01 07 | 00 00 07 00 00 00 43 4d |o.......|......CM|
|00000020| 41 54 48 2e 48 2f 2a 20 | 20 20 20 43 4d 41 54 48 |ATH.H/* | CMATH|
|00000030| 2e 48 0d 0a 0d 0a 20 20 | 20 20 20 20 43 6f 6d 70 |.H.... | Comp|
|00000040| 6c 65 78 20 6c 69 62 72 | 61 72 79 20 66 6f 72 20 |lex libr|ary for |
|00000050| 74 68 65 20 6c 61 6e 67 | 75 61 67 65 73 20 43 20 |the lang|uages C |
|00000060| 61 6e 64 20 43 2b 2b 2e | 0d 0a 0d 0a 20 20 20 20 |and C++.|.... |
|00000070| 20 20 43 6f 70 79 72 69 | 67 68 74 20 28 43 29 20 | Copyri|ght (C) |
|00000080| 31 39 39 36 2d 31 39 39 | 38 20 4d 61 72 74 69 6e |1996-199|8 Martin|
|00000090| 20 53 61 6e 64 65 72 0d | 0a 20 20 20 20 20 20 41 | Sander.|. A|
|000000a0| 64 64 72 65 73 73 20 6f | 66 20 74 68 65 20 61 75 |ddress o|f the au|
|000000b0| 74 68 6f 72 3a 0d 0a 20 | 20 20 20 20 20 20 20 20 |thor:.. | |
|000000c0| 20 20 4d 61 72 74 69 6e | 20 53 61 6e 64 65 72 0d | Martin| Sander.|
|000000d0| 0a 20 20 20 20 20 20 20 | 20 20 20 20 53 65 72 74 |. | Sert|
|000000e0| fc 72 6e 65 72 73 74 72 | 2e 20 31 31 0d 0a 20 20 |.rnerstr|. 11.. |
|000000f0| 20 20 20 20 20 20 20 20 | 20 44 2d 33 37 30 38 35 | | D-37085|
|00000100| 20 47 f6 74 74 69 6e 67 | 65 6e 0d 0a 20 20 20 20 | G.tting|en.. |
|00000110| 20 20 20 20 20 20 20 47 | 65 72 6d 61 6e 79 0d 0a | G|ermany..|
|00000120| 0d 0a 20 20 20 20 20 20 | 53 6f 6d 65 20 66 65 61 |.. |Some fea|
|00000130| 74 75 72 65 73 3a 0d 0a | 20 20 20 20 20 20 2a 20 |tures:..| * |
|00000140| 20 41 6c 6c 20 74 68 72 | 65 65 20 70 72 65 63 69 | All thr|ee preci|
|00000150| 73 69 6f 6e 20 6c 65 76 | 65 6c 73 20 28 73 69 6e |sion lev|els (sin|
|00000160| 67 6c 65 2c 20 64 6f 75 | 62 6c 65 2c 20 65 78 74 |gle, dou|ble, ext|
|00000170| 65 6e 64 65 64 29 0d 0a | 20 20 20 20 20 20 2a 20 |ended)..| * |
|00000180| 20 4e 6f 74 20 6f 6e 6c | 79 20 66 6f 72 20 43 2b | Not onl|y for C+|
|00000190| 2b 2c 20 62 75 74 20 61 | 6c 73 6f 20 66 6f 72 20 |+, but a|lso for |
|000001a0| 43 2e 0d 0a 20 20 20 20 | 20 20 2a 20 20 55 73 65 |C... | * Use|
|000001b0| 73 20 43 2b 2b 20 66 65 | 61 74 75 72 65 73 20 6f |s C++ fe|atures o|
|000001c0| 6e 6c 79 20 77 68 65 72 | 65 20 69 74 20 72 65 61 |nly wher|e it rea|
|000001d0| 6c 6c 79 20 6d 61 6b 65 | 73 20 73 65 6e 73 65 3a |lly make|s sense:|
|000001e0| 0d 0a 20 20 20 20 20 20 | 20 20 20 66 6f 72 20 74 |.. | for t|
|000001f0| 68 65 20 6f 76 65 72 6c | 6f 61 64 69 6e 67 20 6f |he overl|oading o|
|00000200| 66 20 62 61 73 69 63 20 | 6f 70 65 72 61 74 6f 72 |f basic |operator|
|00000210| 73 20 61 6e 64 20 66 6f | 72 0d 0a 20 20 20 20 20 |s and fo|r.. |
|00000220| 20 20 20 20 61 6c 74 65 | 72 6e 61 74 69 76 65 20 | alte|rnative |
|00000230| 66 75 6e 63 74 69 6f 6e | 20 6e 61 6d 65 73 20 69 |function| names i|
|00000240| 6e 64 65 70 65 6e 64 65 | 6e 74 20 6f 66 20 64 61 |ndepende|nt of da|
|00000250| 74 61 20 74 79 70 65 2e | 0d 0a 20 20 20 20 20 20 |ta type.|.. |
|00000260| 2a 20 20 4d 61 74 68 65 | 6d 61 74 69 63 61 6c 20 |* Mathe|matical |
|00000270| 66 75 6e 63 74 69 6f 6e | 73 20 61 72 65 20 69 6d |function|s are im|
|00000280| 70 6c 65 6d 65 6e 74 65 | 64 20 69 6e 20 41 73 73 |plemente|d in Ass|
|00000290| 65 6d 62 6c 65 72 0d 0a | 20 20 20 20 20 20 20 20 |embler..| |
|000002a0| 20 61 6e 64 20 6d 75 63 | 68 20 6d 6f 72 65 20 61 | and muc|h more a|
|000002b0| 63 63 75 72 61 74 65 20 | 61 6e 64 20 65 66 66 69 |ccurate |and effi|
|000002c0| 63 69 65 6e 74 20 74 68 | 61 6e 20 74 68 6f 73 65 |cient th|an those|
|000002d0| 0d 0a 20 20 20 20 20 20 | 20 20 20 6f 66 20 74 68 |.. | of th|
|000002e0| 65 20 63 6f 6d 70 6c 65 | 78 20 6c 69 62 72 61 72 |e comple|x librar|
|000002f0| 79 20 6f 66 20 6e 6f 72 | 6d 61 6c 20 43 2b 2b 20 |y of nor|mal C++ |
|00000300| 63 6f 6d 70 69 6c 65 72 | 73 2e 0d 0a 20 20 20 20 |compiler|s... |
|00000310| 20 20 2a 20 20 56 65 63 | 74 6f 72 69 7a 65 64 20 | * Vec|torized |
|00000320| 76 65 72 73 69 6f 6e 73 | 20 6f 66 20 61 6c 6c 20 |versions| of all |
|00000330| 66 75 6e 63 74 69 6f 6e | 73 20 61 72 65 20 63 6f |function|s are co|
|00000340| 6e 74 61 69 6e 65 64 0d | 0a 20 20 20 20 20 20 20 |ntained.|. |
|00000350| 20 20 69 6e 20 56 65 63 | 74 6f 72 4c 69 62 2c 20 | in Vec|torLib, |
|00000360| 73 65 70 61 72 61 74 65 | 6c 79 20 61 76 61 69 6c |separate|ly avail|
|00000370| 61 62 6c 65 20 66 72 6f | 6d 20 74 68 65 20 73 61 |able fro|m the sa|
|00000380| 6d 65 0d 0a 20 20 20 20 | 20 20 20 20 20 61 75 74 |me.. | aut|
|00000390| 68 6f 72 2e 0d 0a 0d 0a | 20 20 20 20 20 20 54 69 |hor.....| Ti|
|000003a0| 70 73 3a 0d 0a 20 20 20 | 20 20 20 31 2e 20 49 66 |ps:.. | 1. If|
|000003b0| 20 79 6f 75 20 61 72 65 | 20 75 73 69 6e 67 20 6f | you are| using o|
|000003c0| 6e 6c 79 20 6f 6e 65 20 | 6f 66 20 74 68 65 20 74 |nly one |of the t|
|000003d0| 68 72 65 65 20 70 72 65 | 63 69 73 69 6f 6e 0d 0a |hree pre|cision..|
|000003e0| 20 20 20 20 20 20 20 20 | 20 6c 65 76 65 6c 73 2c | | levels,|
|000003f0| 20 79 6f 75 20 73 68 6f | 75 6c 64 20 6e 6f 74 20 | you sho|uld not |
|00000400| 69 6e 63 6c 75 64 65 20 | 74 68 69 73 20 68 65 61 |include |this hea|
|00000410| 64 65 72 20 66 69 6c 65 | 20 63 6d 61 74 68 2e 68 |der file| cmath.h|
|00000420| 2c 0d 0a 20 20 20 20 20 | 20 20 20 20 62 75 74 20 |,.. | but |
|00000430| 6f 6e 6c 79 20 74 68 65 | 20 6f 6e 65 20 66 6f 72 |only the| one for|
|00000440| 20 74 68 65 20 70 72 65 | 63 69 73 69 6f 6e 20 79 | the pre|cision y|
|00000450| 6f 75 20 63 68 6f 73 65 | 3a 0d 0a 20 20 20 20 20 |ou chose|:.. |
|00000460| 20 20 20 20 63 66 6d 61 | 74 68 2e 68 20 20 66 6f | cfma|th.h fo|
|00000470| 72 20 73 69 6e 67 6c 65 | 20 70 72 65 63 69 73 69 |r single| precisi|
|00000480| 6f 6e 20 28 63 6f 6d 70 | 6c 65 78 20 66 6c 6f 61 |on (comp|lex floa|
|00000490| 74 29 0d 0a 20 20 20 20 | 20 20 20 20 20 63 64 6d |t).. | cdm|
|000004a0| 61 74 68 2e 68 20 20 66 | 6f 72 20 64 6f 75 62 6c |ath.h f|or doubl|
|000004b0| 65 20 70 72 65 63 69 73 | 69 6f 6e 20 28 63 6f 6d |e precis|ion (com|
|000004c0| 70 6c 65 78 20 64 6f 75 | 62 6c 65 29 0d 0a 20 20 |plex dou|ble).. |
|000004d0| 20 20 20 20 20 20 20 63 | 65 6d 61 74 68 2e 68 20 | c|emath.h |
|000004e0| 20 66 6f 72 20 65 78 74 | 65 6e 64 65 64 20 70 72 | for ext|ended pr|
|000004f0| 65 63 69 73 69 6f 6e 20 | 28 63 6f 6d 70 6c 65 78 |ecision |(complex|
|00000500| 20 6c 6f 6e 67 20 64 6f | 75 62 6c 65 29 0d 0a 20 | long do|uble).. |
|00000510| 20 20 20 20 20 20 20 20 | 54 68 69 73 20 77 69 6c | |This wil|
|00000520| 6c 20 73 61 76 65 20 79 | 6f 75 20 73 6f 6d 65 20 |l save y|ou some |
|00000530| 63 6f 6d 70 69 6c 65 20 | 74 69 6d 65 20 61 6e 64 |compile |time and|
|00000540| 20 73 6f 6d 65 20 63 6f | 6d 70 69 6c 65 72 0d 0a | some co|mpiler..|
|00000550| 20 20 20 20 20 20 20 20 | 20 62 75 66 66 65 72 20 | | buffer |
|00000560| 6d 65 6d 6f 72 79 2e 0d | 0a 20 20 20 20 20 20 32 |memory..|. 2|
|00000570| 2e 20 49 66 20 79 6f 75 | 20 77 61 6e 74 20 74 6f |. If you| want to|
|00000580| 20 75 73 65 20 74 68 65 | 20 63 6c 61 73 73 20 63 | use the| class c|
|00000590| 6f 6d 70 6c 65 78 2c 20 | 6f 72 20 74 68 65 20 63 |omplex, |or the c|
|000005a0| 6c 61 73 73 65 73 0d 0a | 20 20 20 20 20 20 20 20 |lasses..| |
|000005b0| 20 63 6f 6d 70 6c 65 78 | 3c 66 6c 6f 61 74 3e 2c | complex|<float>,|
|000005c0| 20 63 6f 6d 70 6c 65 78 | 3c 64 6f 75 62 6c 65 3e | complex|<double>|
|000005d0| 2c 20 6f 72 20 63 6f 6d | 70 6c 65 78 3c 6c 6f 6e |, or com|plex<lon|
|000005e0| 67 20 64 6f 75 62 6c 65 | 3e 0d 0a 20 20 20 20 20 |g double|>.. |
|000005f0| 20 20 20 20 6f 66 20 74 | 68 65 20 53 74 61 6e 64 | of t|he Stand|
|00000600| 61 72 64 20 43 2b 2b 20 | 4c 69 62 72 61 72 79 2c |ard C++ |Library,|
|00000610| 20 69 6e 63 6c 75 64 65 | 20 3c 6e 65 77 63 70 6c | include| <newcpl|
|00000620| 78 2e 68 3e 20 62 65 66 | 6f 72 65 20 28 21 29 0d |x.h> bef|ore (!).|
|00000630| 0a 20 20 20 20 20 20 20 | 20 20 3c 63 6d 61 74 68 |. | <cmath|
|00000640| 2e 68 3e 2e 20 44 6f 20 | 20 6e 20 6f 20 74 20 20 |.h>. Do | n o t |
|00000650| 69 6e 63 6c 75 64 65 20 | 3c 63 6f 6d 70 6c 65 78 |include |<complex|
|00000660| 2e 68 3e 2c 20 77 68 69 | 63 68 20 69 73 20 72 65 |.h>, whi|ch is re|
|00000670| 70 6c 61 63 65 64 0d 0a | 20 20 20 20 20 20 20 20 |placed..| |
|00000680| 20 68 65 72 65 20 62 79 | 20 3c 6e 65 77 63 70 6c | here by| <newcpl|
|00000690| 78 2e 68 3e 2e 0d 0a 0d | 0a 2a 2f 0d 0a 0d 0a 23 |x.h>....|.*/....#|
|000006a0| 69 66 6e 64 65 66 20 5f | 5f 43 4d 41 54 48 5f 48 |ifndef _|_CMATH_H|
|000006b0| 0d 0a 23 64 65 66 69 6e | 65 20 5f 5f 43 4d 41 54 |..#defin|e __CMAT|
|000006c0| 48 5f 48 0d 0a 0d 0a 23 | 69 6e 63 6c 75 64 65 20 |H_H....#|include |
|000006d0| 22 63 66 6d 61 74 68 2e | 68 22 0d 0a 23 69 6e 63 |"cfmath.|h"..#inc|
|000006e0| 6c 75 64 65 20 22 63 64 | 6d 61 74 68 2e 68 22 0d |lude "cd|math.h".|
|000006f0| 0a 23 69 6e 63 6c 75 64 | 65 20 22 63 65 6d 61 74 |.#includ|e "cemat|
|00000700| 68 2e 68 22 0d 0a 0d 0a | 23 65 6e 64 69 66 20 2f |h.h"....|#endif /|
|00000710| 2a 20 20 5f 5f 43 4d 41 | 54 48 5f 48 20 20 2a 2f |* __CMA|TH_H */|
|00000720| 0d 0a 0d 0a 0d 0a 50 4b | 03 04 0a 00 00 00 00 00 |......PK|........|
|00000730| 20 0b 55 25 6e e1 f3 69 | 12 fd 00 00 12 fd 00 00 | .U%n..i|........|
|00000740| 09 00 00 00 4e 45 57 43 | 50 4c 58 2e 48 2f 2a 20 |....NEWC|PLX.H/* |
|00000750| 6e 65 77 63 6d 70 6c 78 | 2e 68 0d 0a 0d 0a 20 20 |newcmplx|.h.... |
|00000760| 20 20 49 6e 63 6c 75 64 | 65 2d 46 69 6c 65 20 66 | Includ|e-File f|
|00000770| 6f 72 20 74 68 65 20 43 | 4d 41 54 48 20 43 6f 6d |or the C|MATH Com|
|00000780| 70 6c 65 78 20 4e 75 6d | 62 65 72 20 4c 69 62 72 |plex Num|ber Libr|
|00000790| 61 72 79 0d 0a 20 20 20 | 20 72 65 70 6c 61 63 65 |ary.. | replace|
|000007a0| 73 20 3c 63 6f 6d 70 6c | 65 78 2e 68 3e 2e 0d 0a |s <compl|ex.h>...|
|000007b0| 0d 0a 20 20 20 20 43 6f | 70 79 72 69 67 68 74 20 |.. Co|pyright |
|000007c0| 28 43 29 20 31 39 39 36 | 2d 31 39 39 38 20 4d 61 |(C) 1996|-1998 Ma|
|000007d0| 72 74 69 6e 20 53 61 6e | 64 65 72 0d 0a 20 20 20 |rtin San|der.. |
|000007e0| 20 41 64 64 72 65 73 73 | 20 6f 66 20 74 68 65 20 | Address| of the |
|000007f0| 61 75 74 68 6f 72 3a 0d | 0a 20 20 20 20 20 20 20 |author:.|. |
|00000800| 20 20 20 20 4d 61 72 74 | 69 6e 20 53 61 6e 64 65 | Mart|in Sande|
|00000810| 72 20 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 53 |r .. | S|
|00000820| 65 72 74 fc 72 6e 65 72 | 73 74 72 2e 20 31 31 0d |ert.rner|str. 11.|
|00000830| 0a 20 20 20 20 20 20 20 | 20 20 20 20 44 2d 33 37 |. | D-37|
|00000840| 30 38 35 20 47 f6 74 74 | 69 6e 67 65 6e 0d 0a 20 |085 G.tt|ingen.. |
|00000850| 20 20 20 20 20 20 20 20 | 20 20 47 65 72 6d 61 6e | | German|
|00000860| 79 0d 0a 20 20 20 20 20 | 20 20 20 20 20 20 65 2d |y.. | e-|
|00000870| 6d 61 69 6c 3a 20 4d 61 | 72 74 69 6e 53 61 6e 64 |mail: Ma|rtinSand|
|00000880| 65 72 40 42 69 67 66 6f | 6f 74 2e 63 6f 6d 0d 0a |er@Bigfo|ot.com..|
|00000890| 0d 0a 20 20 20 20 66 6f | 72 20 43 2b 2b 2c 20 74 |.. fo|r C++, t|
|000008a0| 68 65 20 66 6f 6c 6c 6f | 77 69 6e 67 20 63 6c 61 |he follo|wing cla|
|000008b0| 73 73 65 73 20 61 72 65 | 20 64 65 66 69 6e 65 64 |sses are| defined|
|000008c0| 3a 0d 0a 20 20 20 20 61 | 29 20 69 66 20 79 6f 75 |:.. a|) if you|
|000008d0| 20 63 68 6f 6f 73 65 20 | 74 68 65 20 22 63 6c 61 | choose |the "cla|
|000008e0| 73 73 69 63 22 20 42 6f | 72 6c 61 6e 64 20 43 2b |ssic" Bo|rland C+|
|000008f0| 2b 20 73 74 79 6c 65 3a | 20 20 63 6c 61 73 73 20 |+ style:| class |
|00000900| 63 6f 6d 70 6c 65 78 3b | 0d 0a 20 20 20 20 62 29 |complex;|.. b)|
|00000910| 20 6f 74 68 65 72 77 69 | 73 65 3a 0d 0a 20 20 20 | otherwi|se:.. |
|00000920| 20 20 20 20 63 6c 61 73 | 73 65 73 20 63 6f 6d 70 | clas|ses comp|
|00000930| 6c 65 78 3c 66 6c 6f 61 | 74 3e 2c 20 63 6f 6d 70 |lex<floa|t>, comp|
|00000940| 6c 65 78 3c 64 6f 75 62 | 6c 65 3e 2c 20 61 6e 64 |lex<doub|le>, and|
|00000950| 20 63 6f 6d 70 6c 65 78 | 3c 6c 6f 6e 67 20 64 6f | complex|<long do|
|00000960| 75 62 6c 65 3e 2e 0d 0a | 20 20 20 20 66 43 6f 6d |uble>...| fCom|
|00000970| 70 6c 65 78 2c 20 64 43 | 6f 6d 70 6c 65 78 2c 20 |plex, dC|omplex, |
|00000980| 61 6e 64 20 65 43 6f 6d | 70 6c 65 78 20 61 72 65 |and eCom|plex are|
|00000990| 20 64 65 66 69 6e 65 64 | 20 61 73 20 73 79 6e 6f | defined| as syno|
|000009a0| 6e 79 6d 73 20 66 6f 72 | 20 74 68 65 73 65 20 63 |nyms for| these c|
|000009b0| 6c 61 73 73 65 73 2e 0d | 0a 0d 0a 20 20 20 20 46 |lasses..|... F|
|000009c0| 6f 20 70 6c 61 69 6e 20 | 43 2c 20 75 73 65 20 3c |o plain |C, use <|
|000009d0| 63 6d 61 74 68 2e 68 3e | 20 69 6e 73 74 65 61 64 |cmath.h>| instead|
|000009e0| 2c 20 77 68 69 63 68 20 | 64 65 63 6c 61 72 65 73 |, which |declares|
|000009f0| 20 66 43 6f 6d 70 6c 65 | 78 2c 20 64 43 6f 6d 70 | fComple|x, dComp|
|00000a00| 6c 65 78 2c 0d 0a 20 20 | 20 20 61 6e 64 20 65 43 |lex,.. | and eC|
|00000a10| 6f 6d 70 6c 65 78 20 61 | 73 20 73 74 72 75 63 74 |omplex a|s struct|
|00000a20| 73 2c 20 61 6c 6f 6e 67 | 20 77 69 74 68 20 74 68 |s, along| with th|
|00000a30| 65 20 73 61 6d 65 20 72 | 61 6e 67 65 20 6f 66 20 |e same r|ange of |
|00000a40| 66 75 6e 63 74 69 6f 6e | 73 20 61 73 0d 0a 20 20 |function|s as.. |
|00000a50| 20 20 70 72 65 73 65 6e | 74 20 69 6e 20 74 68 65 | presen|t in the|
|00000a60| 20 63 6f 6d 70 6c 65 78 | 20 43 2b 2b 20 63 6c 61 | complex| C++ cla|
|00000a70| 73 73 65 73 2e 0d 0a 0d | 0a 20 20 20 20 54 68 65 |sses....|. The|
|00000a80| 20 63 6c 61 73 73 65 73 | 20 63 6f 6d 70 6c 65 78 | classes| complex|
|00000a90| 20 61 6e 64 20 63 6f 6d | 70 6c 65 78 3c 64 6f 75 | and com|plex<dou|
|00000aa0| 62 6c 65 3e 20 61 72 65 | 20 62 69 6e 61 72 79 20 |ble> are| binary |
|00000ab0| 63 6f 6d 70 61 74 69 62 | 6c 65 20 77 69 74 68 0d |compatib|le with.|
|00000ac0| 0a 20 20 20 20 74 68 65 | 20 43 20 73 74 72 75 63 |. the| C struc|
|00000ad0| 74 20 64 43 6f 6d 70 6c | 65 78 2e 20 53 69 6d 69 |t dCompl|ex. Simi|
|00000ae0| 6c 61 72 6c 79 2c 20 63 | 6f 6d 70 6c 65 78 3c 66 |larly, c|omplex<f|
|00000af0| 6c 6f 61 74 3e 20 61 6e | 64 20 73 74 72 75 63 74 |loat> an|d struct|
|00000b00| 20 66 43 6f 6d 70 6c 65 | 78 0d 0a 20 20 20 20 61 | fComple|x.. a|
|00000b10| 73 20 77 65 6c 6c 20 61 | 73 20 63 6c 61 73 73 20 |s well a|s class |
|00000b20| 63 6f 6d 70 6c 65 78 3c | 6c 6f 6e 67 20 64 6f 75 |complex<|long dou|
|00000b30| 62 6c 65 3e 20 61 6e 64 | 20 73 74 72 75 63 74 20 |ble> and| struct |
|00000b40| 65 43 6f 6d 70 6c 65 78 | 20 61 72 65 20 6d 75 74 |eComplex| are mut|
|00000b50| 75 61 6c 6c 79 0d 0a 20 | 20 20 20 63 6f 6d 70 61 |ually.. | compa|
|00000b60| 74 69 62 6c 65 2e 20 54 | 68 69 73 20 69 73 20 69 |tible. T|his is i|
|00000b70| 6d 70 6f 72 74 61 6e 74 | 20 69 66 20 6f 6e 65 20 |mportant| if one |
|00000b80| 68 61 73 20 70 72 6f 67 | 72 61 6d 73 20 77 69 74 |has prog|rams wit|
|00000b90| 68 20 73 6f 6d 65 20 6d | 6f 64 75 6c 65 73 0d 0a |h some m|odules..|
|00000ba0| 20 20 20 20 77 72 69 74 | 74 65 6e 20 69 6e 20 43 | writ|ten in C|
|00000bb0| 2c 20 6f 74 68 65 72 73 | 20 69 6e 20 43 2b 2b 2e |, others| in C++.|
|00000bc0| 0d 0a 0d 0a 20 20 20 20 | 41 6c 6c 20 6d 61 74 68 |.... |All math|
|00000bd0| 65 6d 61 74 69 63 61 6c | 20 63 6f 6d 70 6c 65 78 |ematical| complex|
|00000be0| 20 66 75 6e 63 74 69 6f | 6e 73 20 61 72 65 20 69 | functio|ns are i|
|00000bf0| 6d 70 6c 65 6d 65 6e 74 | 65 64 20 61 73 20 61 20 |mplement|ed as a |
|00000c00| 6c 69 62 72 61 72 79 0d | 0a 20 20 20 20 77 72 69 |library.|. wri|
|00000c10| 74 74 65 6e 20 69 6e 20 | 41 73 73 65 6d 62 6c 65 |tten in |Assemble|
|00000c20| 72 20 6c 61 6e 67 75 61 | 67 65 2e 20 49 6e 20 63 |r langua|ge. In c|
|00000c30| 6f 6d 70 61 72 69 73 6f | 6e 20 74 6f 20 43 2b 2b |ompariso|n to C++|
|00000c40| 20 69 6e 6c 69 6e 65 20 | 66 75 6e 63 74 69 6f 6e | inline |function|
|00000c50| 73 2c 0d 0a 20 20 20 20 | 74 68 69 73 20 6c 65 61 |s,.. |this lea|
|00000c60| 64 73 20 74 6f 20 67 72 | 65 61 74 65 72 20 70 72 |ds to gr|eater pr|
|00000c70| 65 63 69 73 69 6f 6e 2c | 20 67 72 65 61 74 65 72 |ecision,| greater|
|00000c80| 20 73 70 65 65 64 20 61 | 6e 64 20 62 65 73 74 20 | speed a|nd best |
|00000c90| 73 65 63 75 72 69 74 79 | 20 64 75 65 0d 0a 20 20 |security| due.. |
|00000ca0| 20 20 74 6f 20 63 6f 6d | 70 6c 65 74 65 20 65 72 | to com|plete er|
|00000cb0| 72 6f 72 20 68 61 6e 64 | 6c 69 6e 67 20 76 69 61 |ror hand|ling via|
|00000cc0| 20 74 68 65 20 73 74 61 | 6e 64 61 72 64 20 43 20 | the sta|ndard C |
|00000cd0| 65 72 72 6f 72 20 68 61 | 6e 64 6c 69 6e 67 20 66 |error ha|ndling f|
|00000ce0| 75 6e 63 74 69 6f 6e 73 | 0d 0a 20 20 20 20 5f 6d |unctions|.. _m|
|00000cf0| 61 74 68 65 72 72 28 29 | 20 28 66 6f 72 20 63 6f |atherr()| (for co|
|00000d00| 6d 70 6c 65 78 3c 66 6c | 6f 61 74 3e 20 61 6e 64 |mplex<fl|oat> and|
|00000d10| 20 63 6f 6d 70 6c 65 78 | 3c 64 6f 75 62 6c 65 3e | complex|<double>|
|00000d20| 29 0d 0a 20 20 20 20 61 | 6e 64 20 5f 6d 61 74 68 |).. a|nd _math|
|00000d30| 65 72 72 6c 28 29 20 28 | 66 6f 72 20 63 6f 6d 70 |errl() (|for comp|
|00000d40| 6c 65 78 3c 6c 6f 6e 67 | 20 64 6f 75 62 6c 65 3e |lex<long| double>|
|00000d50| 29 2e 0d 0a 0d 0a 20 20 | 20 20 54 68 65 20 64 65 |)..... | The de|
|00000d60| 63 6c 61 72 61 74 69 6f | 6e 73 20 66 6f 72 20 74 |claratio|ns for t|
|00000d70| 68 65 20 53 74 61 6e 64 | 61 72 64 20 4c 69 62 72 |he Stand|ard Libr|
|00000d80| 61 72 79 20 63 6f 6d 70 | 6c 65 78 20 63 6c 61 73 |ary comp|lex clas|
|00000d90| 73 65 73 20 68 61 76 65 | 0d 0a 20 20 20 20 70 61 |ses have|.. pa|
|00000da0| 72 74 6c 79 20 62 65 65 | 6e 20 61 64 61 70 74 65 |rtly bee|n adapte|
|00000db0| 64 20 66 72 6f 6d 20 74 | 68 65 20 69 6d 70 6c 65 |d from t|he imple|
|00000dc0| 6d 65 6e 74 61 74 69 6f | 6e 20 62 79 20 52 6f 67 |mentatio|n by Rog|
|00000dd0| 75 65 20 57 61 76 65 20 | 53 6f 66 74 77 61 72 65 |ue Wave |Software|
|00000de0| 2c 20 49 6e 63 2e 0d 0a | 20 20 20 20 54 68 65 20 |, Inc...| The |
|00000df0| 66 75 6e 63 74 69 6f 6e | 20 62 6f 64 69 65 73 2c |function| bodies,|
|00000e00| 20 68 6f 77 65 76 65 72 | 2c 20 61 72 65 20 63 6f | however|, are co|
|00000e10| 6d 70 6c 65 74 65 6c 79 | 20 6e 65 77 2e 0d 0a 0d |mpletely| new....|
|00000e20| 0a 20 20 20 20 4e 6f 74 | 65 20 74 68 65 20 66 6f |. Not|e the fo|
|00000e30| 6c 6c 6f 77 69 6e 67 20 | 69 6d 70 6f 72 74 61 6e |llowing |importan|
|00000e40| 74 20 64 69 66 66 65 72 | 65 6e 63 65 73 20 62 65 |t differ|ences be|
|00000e50| 74 77 65 65 6e 20 74 68 | 69 73 20 69 6d 70 6c 65 |tween th|is imple|
|00000e60| 6d 65 6e 74 61 74 69 6f | 6e 0d 0a 20 20 20 20 61 |mentatio|n.. a|
|00000e70| 6e 64 20 74 68 65 20 6f | 6e 65 20 63 6f 6e 74 61 |nd the o|ne conta|
|00000e80| 69 6e 65 64 20 69 6e 20 | 3c 63 6f 6d 70 6c 65 78 |ined in |<complex|
|00000e90| 2e 68 3e 3a 0d 0a 20 20 | 20 20 2d 20 20 54 68 65 |.h>:.. | - The|
|00000ea0| 20 72 65 61 6c 20 61 6e | 64 20 69 6d 61 67 69 6e | real an|d imagin|
|00000eb0| 61 72 79 20 70 61 72 74 | 73 20 61 72 65 20 64 65 |ary part|s are de|
|00000ec0| 63 6c 61 72 65 64 20 61 | 73 20 70 75 62 6c 69 63 |clared a|s public|
|00000ed0| 20 61 6e 64 20 61 72 65 | 20 72 65 66 65 72 72 65 | and are| referre|
|00000ee0| 64 0d 0a 20 20 20 20 20 | 20 20 74 6f 20 61 73 20 |d.. | to as |
|00000ef0| 20 52 65 20 61 6e 64 20 | 49 6d 2c 20 73 6f 20 74 | Re and |Im, so t|
|00000f00| 68 61 74 20 79 6f 75 20 | 6d 61 79 20 61 6c 77 61 |hat you |may alwa|
|00000f10| 79 73 20 61 63 63 65 73 | 73 20 74 68 65 6d 20 61 |ys acces|s them a|
|00000f20| 73 20 7a 2e 52 65 20 61 | 6e 64 20 7a 2e 49 6d 0d |s z.Re a|nd z.Im.|
|00000f30| 0a 20 20 20 20 20 20 20 | 69 6e 20 61 64 64 69 74 |. |in addit|
|00000f40| 69 6f 6e 20 74 6f 20 74 | 68 65 20 6d 65 6d 62 65 |ion to t|he membe|
|00000f50| 72 20 66 75 6e 63 74 69 | 6f 6e 73 20 72 65 61 6c |r functi|ons real|
|00000f60| 28 7a 29 20 61 6e 64 20 | 69 6d 61 67 28 7a 29 3b |(z) and |imag(z);|
|00000f70| 0d 0a 20 20 20 20 2d 20 | 20 54 68 65 20 61 72 67 |.. - | The arg|
|00000f80| 75 6d 65 6e 74 20 6f 66 | 20 61 6c 6c 20 6d 61 74 |ument of| all mat|
|00000f90| 68 65 6d 61 74 69 63 61 | 6c 20 66 75 6e 63 74 69 |hematica|l functi|
|00000fa0| 6f 6e 73 20 69 73 20 61 | 20 76 61 6c 75 65 2c 20 |ons is a| value, |
|00000fb0| 6e 6f 74 20 61 20 72 65 | 66 65 72 65 6e 63 65 2e |not a re|ference.|
|00000fc0| 0d 0a 20 20 20 20 2d 20 | 20 54 68 65 20 66 6f 6c |.. - | The fol|
|00000fd0| 6c 6f 77 69 6e 67 20 66 | 75 6e 63 74 69 6f 6e 73 |lowing f|unctions|
|00000fe0| 20 61 6e 64 20 6f 70 65 | 72 61 74 6f 72 73 20 68 | and ope|rators h|
|00000ff0| 61 76 65 20 62 65 65 6e | 20 61 64 64 65 64 3a 0d |ave been| added:.|
|00001000| 0a 20 20 20 20 20 20 20 | 66 72 69 65 6e 64 20 63 |. |friend c|
|00001010| 6f 6d 70 6c 65 78 20 20 | 63 75 62 69 63 28 63 6f |omplex |cubic(co|
|00001020| 6d 70 6c 65 78 29 3b 20 | 20 2f 2f 20 20 20 74 68 |mplex); | // th|
|00001030| 69 72 64 20 70 6f 77 65 | 72 0d 0a 20 20 20 20 20 |ird powe|r.. |
|00001040| 20 20 66 72 69 65 6e 64 | 20 63 6f 6d 70 6c 65 78 | friend| complex|
|00001050| 20 20 69 6e 76 28 63 6f | 6d 70 6c 65 78 29 3b 20 | inv(co|mplex); |
|00001060| 20 20 20 2f 2f 20 20 20 | 31 2e 30 20 2f 20 7a 0d | // |1.0 / z.|
|00001070| 0a 20 20 20 20 20 20 20 | 66 72 69 65 6e 64 20 63 |. |friend c|
|00001080| 6f 6d 70 6c 65 78 20 20 | 69 70 6f 77 28 63 6f 6d |omplex |ipow(com|
|00001090| 70 6c 65 78 20 5f 5f 62 | 61 73 65 2c 20 69 6e 74 |plex __b|ase, int|
|000010a0| 20 5f 5f 65 78 70 6f 29 | 3b 20 20 2f 2f 20 69 6e | __expo)|; // in|
|000010b0| 74 65 67 65 72 20 70 6f | 77 65 72 0d 0a 20 20 20 |teger po|wer.. |
|000010c0| 20 20 20 20 66 72 69 65 | 6e 64 20 63 6f 6d 70 6c | frie|nd compl|
|000010d0| 65 78 20 20 6c 6f 67 32 | 28 63 6f 6d 70 6c 65 78 |ex log2|(complex|
|000010e0| 29 3b 0d 0a 20 20 20 20 | 20 20 20 66 72 69 65 6e |);.. | frien|
|000010f0| 64 20 63 6f 6d 70 6c 65 | 78 20 20 70 6f 77 52 65 |d comple|x powRe|
|00001100| 45 78 70 6f 28 63 6f 6d | 70 6c 65 78 20 5f 5f 62 |Expo(com|plex __b|
|00001110| 61 73 65 2c 20 64 6f 75 | 62 6c 65 20 5f 5f 65 78 |ase, dou|ble __ex|
|00001120| 70 6f 52 65 29 3b 0d 0a | 20 20 20 20 20 20 20 20 |poRe);..| |
|00001130| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00001140| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|00001150| 2f 20 65 78 70 6c 69 63 | 69 74 20 70 6f 77 65 72 |/ explic|it power|
|00001160| 20 77 69 74 68 20 72 65 | 61 6c 20 65 78 70 6f 6e | with re|al expon|
|00001170| 65 6e 74 0d 0a 20 20 20 | 20 20 20 20 66 72 69 65 |ent.. | frie|
|00001180| 6e 64 20 63 6f 6d 70 6c | 65 78 20 20 70 6f 77 52 |nd compl|ex powR|
|00001190| 65 42 61 73 65 28 64 6f | 75 62 6c 65 20 5f 5f 62 |eBase(do|uble __b|
|000011a0| 61 73 65 52 65 2c 20 63 | 6f 6d 70 6c 65 78 20 5f |aseRe, c|omplex _|
|000011b0| 5f 65 78 70 6f 29 3b 0d | 0a 20 20 20 20 20 20 20 |_expo);.|. |
|000011c0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000011d0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000011e0| 2f 2f 20 65 78 70 6c 69 | 63 69 74 20 70 6f 77 65 |// expli|cit powe|
|000011f0| 72 20 6f 66 20 72 65 61 | 6c 20 62 61 73 65 0d 0a |r of rea|l base..|
|00001200| 20 20 20 20 20 20 20 66 | 72 69 65 6e 64 20 63 6f | f|riend co|
|00001210| 6d 70 6c 65 78 20 20 71 | 75 61 72 74 69 63 28 63 |mplex q|uartic(c|
|00001220| 6f 6d 70 6c 65 78 29 3b | 20 20 2f 2f 20 66 6f 75 |omplex);| // fou|
|00001230| 72 74 68 20 70 6f 77 65 | 72 0d 0a 20 20 20 20 20 |rth powe|r.. |
|00001240| 20 20 66 72 69 65 6e 64 | 20 63 6f 6d 70 6c 65 78 | friend| complex|
|00001250| 20 20 73 71 75 61 72 65 | 28 63 6f 6d 70 6c 65 78 | square|(complex|
|00001260| 29 3b 0d 0a 20 20 20 20 | 20 20 20 66 72 69 65 6e |);.. | frien|
|00001270| 64 20 69 6e 74 20 20 20 | 20 20 20 6f 70 65 72 61 |d int | opera|
|00001280| 74 6f 72 3d 3d 28 63 6f | 6d 70 6c 65 78 20 26 2c |tor==(co|mplex &,|
|00001290| 20 64 6f 75 62 6c 65 29 | 3b 0d 0a 20 20 20 20 20 | double)|;.. |
|000012a0| 20 20 66 72 69 65 6e 64 | 20 69 6e 74 20 20 20 20 | friend| int |
|000012b0| 20 20 6f 70 65 72 61 74 | 6f 72 21 3d 28 63 6f 6d | operat|or!=(com|
|000012c0| 70 6c 65 78 20 26 2c 20 | 64 6f 75 62 6c 65 29 3b |plex &, |double);|
|000012d0| 0d 0a 20 20 20 20 20 20 | 20 41 6c 73 6f 20 6e 65 |.. | Also ne|
|000012e0| 77 20 61 72 65 20 6d 61 | 6e 79 20 6f 66 20 74 68 |w are ma|ny of th|
|000012f0| 65 20 6d 69 78 65 64 2d | 61 63 63 75 72 61 63 79 |e mixed-|accuracy|
|00001300| 20 6c 65 76 65 6c 20 62 | 69 6e 61 72 79 20 6f 70 | level b|inary op|
|00001310| 65 72 61 74 6f 72 73 2e | 0d 0a 2a 2f 0d 0a 0d 0a |erators.|..*/....|
|00001320| 23 69 66 6e 64 65 66 20 | 5f 5f 63 70 6c 75 73 70 |#ifndef |__cplusp|
|00001330| 6c 75 73 0d 0a 23 65 72 | 72 6f 72 20 4d 75 73 74 |lus..#er|ror Must|
|00001340| 20 75 73 65 20 43 2b 2b | 20 66 6f 72 20 63 6f 6d | use C++| for com|
|00001350| 70 6c 65 78 20 63 6c 61 | 73 73 65 73 2e 20 49 6e |plex cla|sses. In|
|00001360| 63 6c 75 64 65 20 3c 63 | 6d 61 74 68 2e 68 3e 20 |clude <c|math.h> |
|00001370| 66 6f 72 20 74 68 65 20 | 70 6c 61 69 6e 2d 43 20 |for the |plain-C |
|00001380| 76 65 72 73 69 6f 6e 0d | 0a 23 65 6e 64 69 66 0d |version.|.#endif.|
|00001390| 0a 23 69 66 20 21 64 65 | 66 69 6e 65 64 28 5f 5f |.#if !de|fined(__|
|000013a0| 4e 45 57 43 50 4c 58 5f | 48 29 0d 0a 23 64 65 66 |NEWCPLX_|H)..#def|
|000013b0| 69 6e 65 20 5f 5f 4e 45 | 57 43 50 4c 58 5f 48 0d |ine __NE|WCPLX_H.|
|000013c0| 0a 0d 0a 0d 0a 20 20 20 | 20 20 20 2f 2a 20 64 65 |..... | /* de|
|000013d0| 66 69 6e 65 20 5f 56 46 | 41 52 20 74 6f 20 67 65 |fine _VF|AR to ge|
|000013e0| 74 20 61 72 6f 75 6e 64 | 20 74 68 65 20 62 75 67 |t around| the bug|
|000013f0| 67 79 20 64 65 66 69 6e | 69 74 69 6f 6e 20 6f 66 |gy defin|ition of|
|00001400| 20 5f 46 41 52 20 3a 20 | 2a 2f 0d 0a 23 69 66 20 | _FAR : |*/..#if |
|00001410| 64 65 66 69 6e 65 64 20 | 5f 5f 53 4d 41 4c 4c 5f |defined |__SMALL_|
|00001420| 5f 20 7c 7c 20 64 65 66 | 69 6e 65 64 20 5f 5f 4d |_ || def|ined __M|
|00001430| 45 44 49 55 4d 5f 5f 0d | 0a 20 20 20 20 20 23 64 |EDIUM__.|. #d|
|00001440| 65 66 69 6e 65 20 20 20 | 5f 56 46 41 52 20 20 6e |efine |_VFAR n|
|00001450| 65 61 72 20 20 20 2f 2a | 20 65 76 65 6e 20 69 6e |ear /*| even in|
|00001460| 20 63 61 73 65 20 6f 66 | 20 44 53 21 3d 53 53 20 | case of| DS!=SS |
|00001470| 20 2a 2f 0d 0a 23 65 6c | 69 66 20 64 65 66 69 6e | */..#el|if defin|
|00001480| 65 64 20 5f 5f 46 4c 41 | 54 5f 5f 20 7c 7c 20 64 |ed __FLA|T__ || d|
|00001490| 65 66 69 6e 65 64 20 5f | 57 49 4e 33 32 0d 0a 20 |efined _|WIN32.. |
|000014a0| 20 20 20 20 23 64 65 66 | 69 6e 65 20 20 5f 56 46 | #def|ine _VF|
|000014b0| 41 52 0d 0a 23 65 6c 73 | 65 0d 0a 20 20 20 20 20 |AR..#els|e.. |
|000014c0| 23 64 65 66 69 6e 65 20 | 20 20 5f 56 46 41 52 20 |#define | _VFAR |
|000014d0| 20 66 61 72 0d 0a 23 65 | 6e 64 69 66 0d 0a 23 69 | far..#e|ndif..#i|
|000014e0| 66 64 65 66 20 5f 5f 42 | 4f 52 4c 41 4e 44 43 5f |fdef __B|ORLANDC_|
|000014f0| 5f 0d 0a 20 20 20 20 20 | 23 70 72 61 67 6d 61 20 |_.. |#pragma |
|00001500| 6f 70 74 69 6f 6e 20 2d | 61 2d 0d 0a 20 20 20 20 |option -|a-.. |
|00001510| 20 23 69 66 20 28 5f 5f | 42 4f 52 4c 41 4e 44 43 | #if (__|BORLANDC|
|00001520| 5f 5f 20 3e 3d 20 30 78 | 34 35 30 29 0d 0a 20 20 |__ >= 0x|450).. |
|00001530| 20 20 20 20 20 20 20 23 | 64 65 66 69 6e 65 20 5f | #|define _|
|00001540| 5f 63 6d 66 20 5f 52 54 | 4c 45 4e 54 52 59 20 5f |_cmf _RT|LENTRY _|
|00001550| 45 58 50 46 55 4e 43 0d | 0a 20 20 20 20 20 20 20 |EXPFUNC.|. |
|00001560| 20 20 23 64 65 66 69 6e | 65 20 5f 5f 63 6d 6f 20 | #defin|e __cmo |
|00001570| 5f 52 54 4c 45 4e 54 52 | 59 0d 0a 20 20 20 20 23 |_RTLENTR|Y.. #|
|00001580| 65 6c 73 65 0d 0a 20 20 | 20 20 20 20 20 20 20 23 |else.. | #|
|00001590| 64 65 66 69 6e 65 20 5f | 5f 63 6d 66 20 20 5f 43 |define _|_cmf _C|
|000015a0| 64 65 63 6c 20 5f 46 41 | 52 46 55 4e 43 0d 0a 20 |decl _FA|RFUNC.. |
|000015b0| 20 20 20 20 20 20 20 20 | 23 64 65 66 69 6e 65 20 | |#define |
|000015c0| 5f 5f 63 6d 6f 20 20 5f | 43 64 65 63 6c 0d 0a 20 |__cmo _|Cdecl.. |
|000015d0| 20 20 20 23 65 6e 64 69 | 66 0d 0a 20 20 20 20 23 | #endi|f.. #|
|000015e0| 69 66 20 5f 5f 42 4f 52 | 4c 41 4e 44 43 5f 5f 20 |if __BOR|LANDC__ |
|000015f0| 3c 20 30 78 35 30 30 0d | 0a 20 20 20 20 20 20 20 |< 0x500.|. |
|00001600| 20 23 64 65 66 69 6e 65 | 20 56 42 4f 4f 4c 20 69 | #define| VBOOL i|
|00001610| 6e 74 0d 0a 20 20 20 20 | 23 65 6c 73 65 0d 0a 20 |nt.. |#else.. |
|00001620| 20 20 20 20 20 20 20 23 | 64 65 66 69 6e 65 20 56 | #|define V|
|00001630| 42 4f 4f 4c 20 62 6f 6f | 6c 0d 0a 20 20 20 20 23 |BOOL boo|l.. #|
|00001640| 65 6e 64 69 66 0d 0a 23 | 65 6c 73 65 20 2f 2a 20 |endif..#|else /* |
|00001650| 56 69 73 75 61 6c 20 43 | 2b 2b 2c 20 57 61 74 63 |Visual C|++, Watc|
|00001660| 6f 6d 20 2a 2f 0d 0a 20 | 20 20 20 20 23 70 72 61 |om */.. | #pra|
|00001670| 67 6d 61 20 70 61 63 6b | 28 20 70 75 73 68 2c 31 |gma pack|( push,1|
|00001680| 20 29 0d 0a 20 20 20 20 | 20 23 64 65 66 69 6e 65 | ).. | #define|
|00001690| 20 56 42 4f 4f 4c 20 69 | 6e 74 0d 0a 20 20 20 20 | VBOOL i|nt.. |
|000016a0| 20 23 64 65 66 69 6e 65 | 20 5f 5f 63 6d 66 20 5f | #define| __cmf _|
|000016b0| 63 64 65 63 6c 0d 0a 20 | 20 20 20 20 23 64 65 66 |cdecl.. | #def|
|000016c0| 69 6e 65 20 5f 5f 63 6d | 6f 20 5f 63 64 65 63 6c |ine __cm|o _cdecl|
|000016d0| 0d 0a 23 65 6e 64 69 66 | 20 2f 2a 20 61 76 6f 69 |..#endif| /* avoi|
|000016e0| 64 20 69 6e 73 65 72 74 | 69 6f 6e 20 6f 66 20 64 |d insert|ion of d|
|000016f0| 75 6d 6d 79 20 62 79 74 | 65 73 20 20 2a 2f 0d 0a |ummy byt|es */..|
|00001700| 23 64 65 66 69 6e 65 20 | 5f 56 46 41 52 43 20 63 |#define |_VFARC c|
|00001710| 6f 6e 73 74 20 5f 56 46 | 41 52 0d 0a 0d 0a 23 69 |onst _VF|AR....#i|
|00001720| 66 20 21 64 65 66 69 6e | 65 64 28 5f 5f 49 4f 53 |f !defin|ed(__IOS|
|00001730| 54 52 45 41 4d 5f 48 29 | 0d 0a 23 69 6e 63 6c 75 |TREAM_H)|..#inclu|
|00001740| 64 65 20 3c 69 6f 73 74 | 72 65 61 6d 2e 68 3e 0d |de <iost|ream.h>.|
|00001750| 0a 23 65 6e 64 69 66 0d | 0a 0d 0a 23 69 66 20 64 |.#endif.|...#if d|
|00001760| 65 66 69 6e 65 64 28 20 | 43 4d 41 54 48 5f 43 4c |efined( |CMATH_CL|
|00001770| 41 53 53 49 43 5f 43 4f | 4d 50 4c 45 58 20 29 0d |ASSIC_CO|MPLEX ).|
|00001780| 0a 20 20 20 20 20 20 2f | 2f 20 63 6c 61 73 73 69 |. /|/ classi|
|00001790| 63 20 42 6f 72 6c 61 6e | 64 20 43 2b 2b 20 63 6c |c Borlan|d C++ cl|
|000017a0| 61 73 73 20 63 6f 6d 70 | 6c 65 78 20 6f 6e 6c 79 |ass comp|lex only|
|000017b0| 2e 20 54 68 69 73 20 68 | 61 73 20 64 6f 75 62 6c |. This h|as doubl|
|000017c0| 65 20 70 72 65 63 69 73 | 69 6f 6e 2e 0d 0a 20 20 |e precis|ion... |
|000017d0| 20 20 20 20 2f 2f 20 63 | 6f 6d 70 6c 65 78 20 6e | // c|omplex n|
|000017e0| 75 6d 62 65 72 73 20 6f | 66 20 66 6c 6f 61 74 20 |umbers o|f float |
|000017f0| 61 6e 64 20 6f 66 20 6c | 6f 6e 67 20 64 6f 75 62 |and of l|ong doub|
|00001800| 6c 65 20 70 72 65 63 69 | 73 69 6f 6e 20 61 72 65 |le preci|sion are|
|00001810| 0d 0a 20 20 20 20 20 20 | 2f 2f 20 69 6d 70 6c 65 |.. |// imple|
|00001820| 6d 65 6e 74 65 64 20 61 | 73 20 73 74 72 75 63 74 |mented a|s struct|
|00001830| 73 2e 20 53 6f 20 74 68 | 65 72 65 20 69 73 20 6e |s. So th|ere is n|
|00001840| 6f 20 63 6f 6e 73 74 72 | 75 63 74 6f 72 21 20 4d |o constr|uctor! M|
|00001850| 6f 72 65 6f 76 65 72 2c | 20 74 68 65 72 65 0d 0a |oreover,| there..|
|00001860| 20 20 20 20 20 20 2f 2f | 20 61 72 65 20 6e 6f 20 | //| are no |
|00001870| 66 75 6e 63 74 69 6f 6e | 73 20 64 65 66 69 6e 65 |function|s define|
|00001880| 64 20 66 6f 72 20 74 68 | 65 20 66 6c 6f 61 74 20 |d for th|e float |
|00001890| 61 6e 64 20 6c 6f 6e 67 | 20 64 6f 75 62 6c 65 20 |and long| double |
|000018a0| 63 6f 6d 70 6c 65 78 20 | 6e 75 6d 62 65 72 73 2e |complex |numbers.|
|000018b0| 0d 0a 23 69 66 20 21 64 | 65 66 69 6e 65 64 28 5f |..#if !d|efined(_|
|000018c0| 5f 49 4f 53 54 52 45 41 | 4d 5f 48 29 0d 0a 23 69 |_IOSTREA|M_H)..#i|
|000018d0| 6e 63 6c 75 64 65 20 3c | 69 6f 73 74 72 65 61 6d |nclude <|iostream|
|000018e0| 2e 68 3e 0d 0a 23 65 6e | 64 69 66 0d 0a 0d 0a 23 |.h>..#en|dif....#|
|000018f0| 69 66 20 21 64 65 66 69 | 6e 65 64 28 52 43 5f 49 |if !defi|ned(RC_I|
|00001900| 4e 56 4f 4b 45 44 29 0d | 0a 0d 0a 23 69 66 20 64 |NVOKED).|...#if d|
|00001910| 65 66 69 6e 65 64 28 5f | 5f 42 43 4f 50 54 5f 5f |efined(_|_BCOPT__|
|00001920| 29 0d 0a 23 69 66 20 21 | 64 65 66 69 6e 65 64 28 |)..#if !|defined(|
|00001930| 5f 5f 46 4c 41 54 5f 5f | 29 20 26 26 20 28 28 5f |__FLAT__|) && ((_|
|00001940| 5f 42 4f 52 4c 41 4e 44 | 43 5f 5f 20 3c 20 30 78 |_BORLAND|C__ < 0x|
|00001950| 34 35 30 29 20 7c 7c 20 | 21 64 65 66 69 6e 65 64 |450) || |!defined|
|00001960| 28 5f 52 54 4c 5f 41 4c | 4c 4f 57 5f 70 6f 29 29 |(_RTL_AL|LOW_po))|
|00001970| 0d 0a 23 70 72 61 67 6d | 61 20 6f 70 74 69 6f 6e |..#pragm|a option|
|00001980| 20 2d 70 6f 2d 20 20 20 | 20 20 2f 2f 20 64 69 73 | -po- | // dis|
|00001990| 61 62 6c 65 20 4f 62 6a | 65 63 74 20 64 61 74 61 |able Obj|ect data|
|000019a0| 20 63 61 6c 6c 69 6e 67 | 20 63 6f 6e 76 65 6e 74 | calling| convent|
|000019b0| 69 6f 6e 0d 0a 23 65 6e | 64 69 66 0d 0a 23 65 6e |ion..#en|dif..#en|
|000019c0| 64 69 66 0d 0a 0d 0a 23 | 70 72 61 67 6d 61 20 6f |dif....#|pragma o|
|000019d0| 70 74 69 6f 6e 20 2d 56 | 6f 2d 0d 0a 0d 0a 23 69 |ption -V|o-....#i|
|000019e0| 66 20 64 65 66 69 6e 65 | 64 28 5f 5f 53 54 44 43 |f define|d(__STDC|
|000019f0| 5f 5f 29 0d 0a 23 70 72 | 61 67 6d 61 20 77 61 72 |__)..#pr|agma war|
|00001a00| 6e 20 2d 6e 61 6b 0d 0a | 23 65 6e 64 69 66 0d 0a |n -nak..|#endif..|
|00001a10| 0d 0a 23 65 6e 64 69 66 | 20 20 2f 2a 20 21 52 43 |..#endif| /* !RC|
|00001a20| 5f 49 4e 56 4f 4b 45 44 | 20 2a 2f 0d 0a 0d 0a 23 |_INVOKED| */....#|
|00001a30| 69 66 28 5f 5f 42 4f 52 | 4c 41 4e 44 43 5f 5f 20 |if(__BOR|LANDC__ |
|00001a40| 3e 3d 20 30 78 34 35 30 | 29 0d 0a 63 6c 61 73 73 |>= 0x450|)..class|
|00001a50| 20 5f 45 58 50 43 4c 41 | 53 53 20 63 6f 6d 70 6c | _EXPCLA|SS compl|
|00001a60| 65 78 20 7b 0d 0a 23 65 | 6c 73 65 0d 0a 5f 43 4c |ex {..#e|lse.._CL|
|00001a70| 41 53 53 44 45 46 28 63 | 6f 6d 70 6c 65 78 29 0d |ASSDEF(c|omplex).|
|00001a80| 0a 63 6c 61 73 73 20 5f | 43 4c 41 53 53 54 59 50 |.class _|CLASSTYP|
|00001a90| 45 20 63 6f 6d 70 6c 65 | 78 20 7b 0d 0a 23 65 6e |E comple|x {..#en|
|00001aa0| 64 69 66 0d 0a 20 20 70 | 75 62 6c 69 63 3a 0d 0a |dif.. p|ublic:..|
|00001ab0| 20 20 20 20 2f 2f 20 63 | 6f 6e 73 74 72 75 63 74 | // c|onstruct|
|00001ac0| 6f 72 73 0d 0a 20 20 20 | 20 63 6f 6d 70 6c 65 78 |ors.. | complex|
|00001ad0| 28 20 64 6f 75 62 6c 65 | 20 52 65 5f 70 61 72 74 |( double| Re_part|
|00001ae0| 2c 20 64 6f 75 62 6c 65 | 20 49 6d 5f 70 61 72 74 |, double| Im_part|
|00001af0| 20 29 20 7b 52 65 3d 52 | 65 5f 70 61 72 74 3b 20 | ) {Re=R|e_part; |
|00001b00| 49 6d 3d 49 6d 5f 70 61 | 72 74 3b 7d 0d 0a 20 20 |Im=Im_pa|rt;}.. |
|00001b10| 20 20 63 6f 6d 70 6c 65 | 78 28 20 64 6f 75 62 6c | comple|x( doubl|
|00001b20| 65 20 52 65 5f 70 61 72 | 74 20 29 20 20 7b 52 65 |e Re_par|t ) {Re|
|00001b30| 3d 52 65 5f 70 61 72 74 | 3b 20 49 6d 3d 30 3b 7d |=Re_part|; Im=0;}|
|00001b40| 0d 0a 20 20 20 20 63 6f | 6d 70 6c 65 78 28 29 20 |.. co|mplex() |
|00001b50| 7b 7d 3b 20 2f 2f 20 6d | 6f 72 65 20 65 66 66 69 |{}; // m|ore effi|
|00001b60| 63 69 65 6e 74 20 74 6f | 20 68 61 76 65 20 74 68 |cient to| have th|
|00001b70| 65 73 65 20 74 68 72 65 | 65 20 73 65 70 61 72 61 |ese thre|e separa|
|00001b80| 74 65 20 76 61 72 69 61 | 6e 74 73 0d 0a 20 20 20 |te varia|nts.. |
|00001b90| 20 2f 2f 20 43 61 72 74 | 65 73 69 61 6e 20 63 6f | // Cart|esian co|
|00001ba0| 6d 70 6c 65 78 20 66 72 | 6f 6d 20 70 6f 6c 61 72 |mplex fr|om polar|
|00001bb0| 20 63 6f 6f 72 64 69 6e | 61 74 65 73 3a 0d 0a 20 | coordin|ates:.. |
|00001bc0| 20 20 20 66 72 69 65 6e | 64 20 63 6f 6d 70 6c 65 | frien|d comple|
|00001bd0| 78 20 5f 5f 63 6d 66 20 | 70 6f 6c 61 72 28 64 6f |x __cmf |polar(do|
|00001be0| 75 62 6c 65 20 5f 6d 61 | 67 2c 20 64 6f 75 62 6c |uble _ma|g, doubl|
|00001bf0| 65 20 5f 61 6e 67 6c 65 | 3d 30 29 3b 0d 0a 20 20 |e _angle|=0);.. |
|00001c00| 20 20 2f 2f 20 62 61 73 | 69 63 20 6f 70 65 72 61 | // bas|ic opera|
|00001c10| 74 69 6f 6e 73 3a 0d 0a | 20 20 20 20 64 6f 75 62 |tions:..| doub|
|00001c20| 6c 65 20 72 65 61 6c 28 | 29 20 7b 20 72 65 74 75 |le real(|) { retu|
|00001c30| 72 6e 20 52 65 3b 20 7d | 20 20 20 20 20 20 20 20 |rn Re; }| |
|00001c40| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 | | // |
|00001c50| 72 65 61 6c 20 70 61 72 | 74 0d 0a 20 20 20 20 64 |real par|t.. d|
|00001c60| 6f 75 62 6c 65 20 72 65 | 61 6c 28 63 6f 6d 70 6c |ouble re|al(compl|
|00001c70| 65 78 20 5f 56 46 41 52 | 43 20 26 5f 7a 29 20 7b |ex _VFAR|C &_z) {|
|00001c80| 20 72 65 74 75 72 6e 20 | 5f 7a 2e 52 65 3b 20 7d | return |_z.Re; }|
|00001c90| 0d 0a 20 20 20 20 64 6f | 75 62 6c 65 20 69 6d 61 |.. do|uble ima|
|00001ca0| 67 28 29 20 7b 20 72 65 | 74 75 72 6e 20 49 6d 3b |g() { re|turn Im;|
|00001cb0| 20 7d 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | } | |
|00001cc0| 20 20 20 20 20 20 20 2f | 2f 20 69 6d 61 67 69 6e | /|/ imagin|
|00001cd0| 61 72 79 20 70 61 72 74 | 0d 0a 20 20 20 20 64 6f |ary part|.. do|
|00001ce0| 75 62 6c 65 20 69 6d 61 | 67 28 63 6f 6d 70 6c 65 |uble ima|g(comple|
|00001cf0| 78 20 5f 56 46 41 52 43 | 20 26 5f 7a 29 20 7b 20 |x _VFARC| &_z) { |
|00001d00| 72 65 74 75 72 6e 20 5f | 7a 2e 49 6d 3b 20 7d 20 |return _|z.Im; } |
|00001d10| 2f 2f 20 69 6d 61 67 69 | 6e 61 72 79 20 70 61 72 |// imagi|nary par|
|00001d20| 74 0d 0a 20 20 20 20 66 | 72 69 65 6e 64 20 63 6f |t.. f|riend co|
|00001d30| 6d 70 6c 65 78 20 5f 5f | 63 6d 66 20 6e 65 67 28 |mplex __|cmf neg(|
|00001d40| 63 6f 6d 70 6c 65 78 20 | 5f 56 46 41 52 43 20 26 |complex |_VFARC &|
|00001d50| 29 3b 20 20 20 2f 2f 20 | 73 61 6d 65 20 61 73 20 |); // |same as |
|00001d60| 75 6e 61 72 79 20 6f 70 | 65 72 61 74 6f 72 20 2d |unary op|erator -|
|00001d70| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|00001d80| 70 6c 65 78 20 5f 5f 63 | 6d 66 20 63 6f 6e 6a 28 |plex __c|mf conj(|
|00001d90| 63 6f 6d 70 6c 65 78 20 | 5f 56 46 41 52 43 20 26 |complex |_VFARC &|
|00001da0| 29 3b 20 20 2f 2f 20 63 | 6f 6d 70 6c 65 78 20 63 |); // c|omplex c|
|00001db0| 6f 6e 6a 75 67 61 74 65 | 0d 0a 20 20 20 20 66 72 |onjugate|.. fr|
|00001dc0| 69 65 6e 64 20 64 6f 75 | 62 6c 65 20 20 5f 5f 63 |iend dou|ble __c|
|00001dd0| 6d 66 20 6e 6f 72 6d 28 | 63 6f 6d 70 6c 65 78 20 |mf norm(|complex |
|00001de0| 5f 56 46 41 52 43 20 26 | 29 3b 20 20 2f 2f 20 73 |_VFARC &|); // s|
|00001df0| 71 75 61 72 65 20 6f 66 | 20 74 68 65 20 6d 61 67 |quare of| the mag|
|00001e00| 6e 69 74 75 64 65 0d 0a | 20 20 20 20 66 72 69 65 |nitude..| frie|
|00001e10| 6e 64 20 64 6f 75 62 6c | 65 20 20 5f 5f 63 6d 66 |nd doubl|e __cmf|
|00001e20| 20 61 72 67 28 63 6f 6d | 70 6c 65 78 29 3b 20 20 | arg(com|plex); |
|00001e30| 20 20 20 20 20 20 20 20 | 20 2f 2f 20 61 6e 67 6c | | // angl|
|00001e40| 65 20 69 6e 20 74 68 65 | 20 70 6c 61 6e 65 0d 0a |e in the| plane..|
|00001e50| 0d 0a 20 20 20 20 20 2f | 2f 20 55 6e 61 72 79 20 |.. /|/ Unary |
|00001e60| 6f 70 65 72 61 74 6f 72 | 73 0d 0a 20 20 20 20 63 |operator|s.. c|
|00001e70| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 20 26 20 5f |omplex _|VFAR & _|
|00001e80| 5f 63 6d 6f 20 6f 70 65 | 72 61 74 6f 72 2b 28 29 |_cmo ope|rator+()|
|00001e90| 3b 0d 0a 20 20 20 20 66 | 72 69 65 6e 64 20 63 6f |;.. f|riend co|
|00001ea0| 6d 70 6c 65 78 20 5f 56 | 46 41 52 20 26 20 5f 5f |mplex _V|FAR & __|
|00001eb0| 63 6d 66 20 6f 70 65 72 | 61 74 6f 72 2d 28 20 63 |cmf oper|ator-( c|
|00001ec0| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 43 20 26 29 |omplex _|VFARC &)|
|00001ed0| 3b 0d 0a 0d 0a 20 20 20 | 20 2f 2f 20 42 69 6e 61 |;.... | // Bina|
|00001ee0| 72 79 20 6f 70 65 72 61 | 74 6f 72 73 0d 0a 20 20 |ry opera|tors.. |
|00001ef0| 20 20 66 72 69 65 6e 64 | 20 63 6f 6d 70 6c 65 78 | friend| complex|
|00001f00| 20 5f 5f 63 6d 66 20 6f | 70 65 72 61 74 6f 72 2b | __cmf o|perator+|
|00001f10| 28 63 6f 6d 70 6c 65 78 | 20 5f 56 46 41 52 43 20 |(complex| _VFARC |
|00001f20| 26 2c 20 63 6f 6d 70 6c | 65 78 20 5f 56 46 41 52 |&, compl|ex _VFAR|
|00001f30| 43 20 26 29 3b 0d 0a 20 | 20 20 20 66 72 69 65 6e |C &);.. | frien|
|00001f40| 64 20 63 6f 6d 70 6c 65 | 78 20 5f 5f 63 6d 66 20 |d comple|x __cmf |
|00001f50| 6f 70 65 72 61 74 6f 72 | 2b 28 64 6f 75 62 6c 65 |operator|+(double|
|00001f60| 2c 20 63 6f 6d 70 6c 65 | 78 20 5f 56 46 41 52 43 |, comple|x _VFARC|
|00001f70| 20 26 29 3b 0d 0a 20 20 | 20 20 66 72 69 65 6e 64 | &);.. | friend|
|00001f80| 20 63 6f 6d 70 6c 65 78 | 20 5f 5f 63 6d 66 20 6f | complex| __cmf o|
|00001f90| 70 65 72 61 74 6f 72 2b | 28 63 6f 6d 70 6c 65 78 |perator+|(complex|
|00001fa0| 20 5f 56 46 41 52 43 20 | 26 2c 20 64 6f 75 62 6c | _VFARC |&, doubl|
|00001fb0| 65 29 3b 0d 0a 20 20 20 | 20 66 72 69 65 6e 64 20 |e);.. | friend |
|00001fc0| 63 6f 6d 70 6c 65 78 20 | 5f 5f 63 6d 66 20 6f 70 |complex |__cmf op|
|00001fd0| 65 72 61 74 6f 72 2d 28 | 63 6f 6d 70 6c 65 78 20 |erator-(|complex |
|00001fe0| 5f 56 46 41 52 43 20 26 | 2c 20 63 6f 6d 70 6c 65 |_VFARC &|, comple|
|00001ff0| 78 20 5f 56 46 41 52 43 | 20 26 29 3b 0d 0a 20 20 |x _VFARC| &);.. |
|00002000| 20 20 66 72 69 65 6e 64 | 20 63 6f 6d 70 6c 65 78 | friend| complex|
|00002010| 20 5f 5f 63 6d 66 20 6f | 70 65 72 61 74 6f 72 2d | __cmf o|perator-|
|00002020| 28 64 6f 75 62 6c 65 2c | 20 63 6f 6d 70 6c 65 78 |(double,| complex|
|00002030| 20 5f 56 46 41 52 43 20 | 26 29 3b 0d 0a 20 20 20 | _VFARC |&);.. |
|00002040| 20 66 72 69 65 6e 64 20 | 63 6f 6d 70 6c 65 78 20 | friend |complex |
|00002050| 5f 5f 63 6d 66 20 6f 70 | 65 72 61 74 6f 72 2d 28 |__cmf op|erator-(|
|00002060| 63 6f 6d 70 6c 65 78 20 | 5f 56 46 41 52 43 20 26 |complex |_VFARC &|
|00002070| 2c 20 64 6f 75 62 6c 65 | 29 3b 0d 0a 20 20 20 20 |, double|);.. |
|00002080| 66 72 69 65 6e 64 20 63 | 6f 6d 70 6c 65 78 20 5f |friend c|omplex _|
|00002090| 5f 63 6d 66 20 6f 70 65 | 72 61 74 6f 72 2a 28 63 |_cmf ope|rator*(c|
|000020a0| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 43 20 26 2c |omplex _|VFARC &,|
|000020b0| 20 63 6f 6d 70 6c 65 78 | 20 5f 56 46 41 52 43 20 | complex| _VFARC |
|000020c0| 26 29 3b 0d 0a 20 20 20 | 20 66 72 69 65 6e 64 20 |&);.. | friend |
|000020d0| 63 6f 6d 70 6c 65 78 20 | 5f 5f 63 6d 66 20 6f 70 |complex |__cmf op|
|000020e0| 65 72 61 74 6f 72 2a 28 | 63 6f 6d 70 6c 65 78 20 |erator*(|complex |
|000020f0| 5f 56 46 41 52 43 20 26 | 2c 20 64 6f 75 62 6c 65 |_VFARC &|, double|
|00002100| 29 3b 0d 0a 20 20 20 20 | 66 72 69 65 6e 64 20 63 |);.. |friend c|
|00002110| 6f 6d 70 6c 65 78 20 5f | 5f 63 6d 66 20 6f 70 65 |omplex _|_cmf ope|
|00002120| 72 61 74 6f 72 2a 28 64 | 6f 75 62 6c 65 2c 20 63 |rator*(d|ouble, c|
|00002130| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 43 20 26 29 |omplex _|VFARC &)|
|00002140| 3b 0d 0a 20 20 20 20 66 | 72 69 65 6e 64 20 63 6f |;.. f|riend co|
|00002150| 6d 70 6c 65 78 20 5f 5f | 63 6d 66 20 6f 70 65 72 |mplex __|cmf oper|
|00002160| 61 74 6f 72 2f 28 63 6f | 6d 70 6c 65 78 20 5f 56 |ator/(co|mplex _V|
|00002170| 46 41 52 43 20 26 2c 20 | 63 6f 6d 70 6c 65 78 20 |FARC &, |complex |
|00002180| 5f 56 46 41 52 43 20 26 | 29 3b 0d 0a 20 20 20 20 |_VFARC &|);.. |
|00002190| 66 72 69 65 6e 64 20 63 | 6f 6d 70 6c 65 78 20 5f |friend c|omplex _|
|000021a0| 5f 63 6d 66 20 6f 70 65 | 72 61 74 6f 72 2f 28 63 |_cmf ope|rator/(c|
|000021b0| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 43 20 26 2c |omplex _|VFARC &,|
|000021c0| 20 64 6f 75 62 6c 65 29 | 3b 0d 0a 20 20 20 20 66 | double)|;.. f|
|000021d0| 72 69 65 6e 64 20 63 6f | 6d 70 6c 65 78 20 5f 5f |riend co|mplex __|
|000021e0| 63 6d 66 20 6f 70 65 72 | 61 74 6f 72 2f 28 64 6f |cmf oper|ator/(do|
|000021f0| 75 62 6c 65 2c 20 63 6f | 6d 70 6c 65 78 20 5f 56 |uble, co|mplex _V|
|00002200| 46 41 52 43 20 26 29 3b | 0d 0a 0d 0a 20 20 20 20 |FARC &);|.... |
|00002210| 66 72 69 65 6e 64 20 56 | 42 4f 4f 4c 20 5f 5f 63 |friend V|BOOL __c|
|00002220| 6d 66 20 6f 70 65 72 61 | 74 6f 72 3d 3d 28 63 6f |mf opera|tor==(co|
|00002230| 6d 70 6c 65 78 20 5f 56 | 46 41 52 43 20 26 2c 20 |mplex _V|FARC &, |
|00002240| 63 6f 6d 70 6c 65 78 20 | 5f 56 46 41 52 43 20 26 |complex |_VFARC &|
|00002250| 29 3b 0d 0a 20 20 20 20 | 66 72 69 65 6e 64 20 56 |);.. |friend V|
|00002260| 42 4f 4f 4c 20 5f 5f 63 | 6d 66 20 6f 70 65 72 61 |BOOL __c|mf opera|
|00002270| 74 6f 72 3d 3d 28 63 6f | 6d 70 6c 65 78 20 5f 56 |tor==(co|mplex _V|
|00002280| 46 41 52 43 20 26 2c 20 | 64 6f 75 62 6c 65 29 3b |FARC &, |double);|
|00002290| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 56 42 4f |.. fr|iend VBO|
|000022a0| 4f 4c 20 5f 5f 63 6d 66 | 20 6f 70 65 72 61 74 6f |OL __cmf| operato|
|000022b0| 72 21 3d 28 63 6f 6d 70 | 6c 65 78 20 5f 56 46 41 |r!=(comp|lex _VFA|
|000022c0| 52 43 20 26 2c 20 63 6f | 6d 70 6c 65 78 20 5f 56 |RC &, co|mplex _V|
|000022d0| 46 41 52 43 20 26 29 3b | 0d 0a 20 20 20 20 66 72 |FARC &);|.. fr|
|000022e0| 69 65 6e 64 20 56 42 4f | 4f 4c 20 5f 5f 63 6d 66 |iend VBO|OL __cmf|
|000022f0| 20 6f 70 65 72 61 74 6f | 72 21 3d 28 63 6f 6d 70 | operato|r!=(comp|
|00002300| 6c 65 78 20 5f 56 46 41 | 52 43 20 26 2c 20 64 6f |lex _VFA|RC &, do|
|00002310| 75 62 6c 65 29 3b 0d 0a | 0d 0a 20 20 20 20 63 6f |uble);..|.. co|
|00002320| 6d 70 6c 65 78 20 5f 56 | 46 41 52 20 26 20 5f 5f |mplex _V|FAR & __|
|00002330| 63 6d 6f 20 6f 70 65 72 | 61 74 6f 72 2b 3d 28 63 |cmo oper|ator+=(c|
|00002340| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 43 20 26 29 |omplex _|VFARC &)|
|00002350| 3b 0d 0a 20 20 20 20 63 | 6f 6d 70 6c 65 78 20 5f |;.. c|omplex _|
|00002360| 56 46 41 52 20 26 20 5f | 5f 63 6d 6f 20 6f 70 65 |VFAR & _|_cmo ope|
|00002370| 72 61 74 6f 72 2b 3d 28 | 64 6f 75 62 6c 65 29 3b |rator+=(|double);|
|00002380| 0d 0a 20 20 20 20 63 6f | 6d 70 6c 65 78 20 5f 56 |.. co|mplex _V|
|00002390| 46 41 52 20 26 20 5f 5f | 63 6d 6f 20 6f 70 65 72 |FAR & __|cmo oper|
|000023a0| 61 74 6f 72 2d 3d 28 63 | 6f 6d 70 6c 65 78 20 5f |ator-=(c|omplex _|
|000023b0| 56 46 41 52 43 20 26 29 | 3b 0d 0a 20 20 20 20 63 |VFARC &)|;.. c|
|000023c0| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 20 26 20 5f |omplex _|VFAR & _|
|000023d0| 5f 63 6d 6f 20 6f 70 65 | 72 61 74 6f 72 2d 3d 28 |_cmo ope|rator-=(|
|000023e0| 64 6f 75 62 6c 65 29 3b | 0d 0a 20 20 20 20 63 6f |double);|.. co|
|000023f0| 6d 70 6c 65 78 20 5f 56 | 46 41 52 20 26 20 5f 5f |mplex _V|FAR & __|
|00002400| 63 6d 6f 20 6f 70 65 72 | 61 74 6f 72 2a 3d 28 63 |cmo oper|ator*=(c|
|00002410| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 43 20 26 29 |omplex _|VFARC &)|
|00002420| 3b 0d 0a 20 20 20 20 63 | 6f 6d 70 6c 65 78 20 5f |;.. c|omplex _|
|00002430| 56 46 41 52 20 26 20 5f | 5f 63 6d 6f 20 6f 70 65 |VFAR & _|_cmo ope|
|00002440| 72 61 74 6f 72 2a 3d 28 | 64 6f 75 62 6c 65 29 3b |rator*=(|double);|
|00002450| 0d 0a 20 20 20 20 63 6f | 6d 70 6c 65 78 20 5f 56 |.. co|mplex _V|
|00002460| 46 41 52 20 26 20 5f 5f | 63 6d 6f 20 6f 70 65 72 |FAR & __|cmo oper|
|00002470| 61 74 6f 72 2f 3d 28 63 | 6f 6d 70 6c 65 78 20 5f |ator/=(c|omplex _|
|00002480| 56 46 41 52 43 20 26 29 | 3b 0d 0a 20 20 20 20 63 |VFARC &)|;.. c|
|00002490| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 20 26 20 5f |omplex _|VFAR & _|
|000024a0| 5f 63 6d 6f 20 6f 70 65 | 72 61 74 6f 72 2f 3d 28 |_cmo ope|rator/=(|
|000024b0| 64 6f 75 62 6c 65 29 3b | 0d 0a 0d 0a 20 20 20 20 |double);|.... |
|000024c0| 2f 2f 20 4f 76 65 72 6c | 6f 61 64 65 64 20 41 4e |// Overl|oaded AN|
|000024d0| 53 49 20 43 20 6d 61 74 | 68 20 66 75 6e 63 74 69 |SI C mat|h functi|
|000024e0| 6f 6e 73 20 77 69 74 68 | 20 65 72 72 6f 72 20 68 |ons with| error h|
|000024f0| 61 6e 64 6c 69 6e 67 20 | 76 69 61 20 6d 61 74 68 |andling |via math|
|00002500| 65 72 72 28 29 3a 0d 0a | 20 20 20 20 66 72 69 65 |err():..| frie|
|00002510| 6e 64 20 64 6f 75 62 6c | 65 20 20 5f 5f 63 6d 66 |nd doubl|e __cmf|
|00002520| 20 61 62 73 28 63 6f 6d | 70 6c 65 78 29 3b 20 20 | abs(com|plex); |
|00002530| 20 20 2f 2f 20 63 6f 6d | 70 6c 65 78 20 70 6f 69 | // com|plex poi|
|00002540| 6e 74 65 72 20 6d 61 67 | 6e 69 74 75 64 65 0d 0a |nter mag|nitude..|
|00002550| 20 20 20 20 66 72 69 65 | 6e 64 20 63 6f 6d 70 6c | frie|nd compl|
|00002560| 65 78 20 5f 5f 63 6d 66 | 20 61 63 6f 73 28 63 6f |ex __cmf| acos(co|
|00002570| 6d 70 6c 65 78 29 3b 0d | 0a 20 20 20 20 66 72 69 |mplex);.|. fri|
|00002580| 65 6e 64 20 63 6f 6d 70 | 6c 65 78 20 5f 5f 63 6d |end comp|lex __cm|
|00002590| 66 20 61 73 69 6e 28 63 | 6f 6d 70 6c 65 78 29 3b |f asin(c|omplex);|
|000025a0| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|000025b0| 70 6c 65 78 20 5f 5f 63 | 6d 66 20 61 74 61 6e 28 |plex __c|mf atan(|
|000025c0| 63 6f 6d 70 6c 65 78 29 | 3b 0d 0a 20 20 20 20 66 |complex)|;.. f|
|000025d0| 72 69 65 6e 64 20 63 6f | 6d 70 6c 65 78 20 5f 5f |riend co|mplex __|
|000025e0| 63 6d 66 20 63 6f 73 28 | 63 6f 6d 70 6c 65 78 29 |cmf cos(|complex)|
|000025f0| 3b 0d 0a 20 20 20 20 66 | 72 69 65 6e 64 20 63 6f |;.. f|riend co|
|00002600| 6d 70 6c 65 78 20 5f 5f | 63 6d 66 20 63 6f 73 68 |mplex __|cmf cosh|
|00002610| 28 63 6f 6d 70 6c 65 78 | 29 3b 0d 0a 20 20 20 20 |(complex|);.. |
|00002620| 66 72 69 65 6e 64 20 63 | 6f 6d 70 6c 65 78 20 5f |friend c|omplex _|
|00002630| 5f 63 6d 66 20 63 75 62 | 69 63 28 63 6f 6d 70 6c |_cmf cub|ic(compl|
|00002640| 65 78 29 3b 20 20 2f 2f | 20 72 61 69 73 65 20 74 |ex); //| raise t|
|00002650| 6f 20 74 68 65 20 74 68 | 69 72 64 20 70 6f 77 65 |o the th|ird powe|
|00002660| 72 0d 0a 20 20 20 20 66 | 72 69 65 6e 64 20 63 6f |r.. f|riend co|
|00002670| 6d 70 6c 65 78 20 5f 5f | 63 6d 66 20 65 78 70 28 |mplex __|cmf exp(|
|00002680| 63 6f 6d 70 6c 65 78 29 | 3b 0d 0a 20 20 20 20 66 |complex)|;.. f|
|00002690| 72 69 65 6e 64 20 63 6f | 6d 70 6c 65 78 20 5f 5f |riend co|mplex __|
|000026a0| 63 6d 66 20 69 6e 76 28 | 63 6f 6d 70 6c 65 78 29 |cmf inv(|complex)|
|000026b0| 3b 20 20 20 20 2f 2f 20 | 20 20 31 2e 30 20 2f 20 |; // | 1.0 / |
|000026c0| 7a 0d 0a 20 20 20 20 66 | 72 69 65 6e 64 20 63 6f |z.. f|riend co|
|000026d0| 6d 70 6c 65 78 20 5f 5f | 63 6d 66 20 69 70 6f 77 |mplex __|cmf ipow|
|000026e0| 28 63 6f 6d 70 6c 65 78 | 20 5f 62 61 73 65 2c 20 |(complex| _base, |
|000026f0| 69 6e 74 20 5f 49 6e 74 | 45 78 70 6f 29 3b 20 20 |int _Int|Expo); |
|00002700| 2f 2f 20 69 6e 74 65 67 | 65 72 20 70 6f 77 65 72 |// integ|er power|
|00002710| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|00002720| 70 6c 65 78 20 5f 5f 63 | 6d 66 20 6c 6e 28 63 6f |plex __c|mf ln(co|
|00002730| 6d 70 6c 65 78 29 3b 0d | 0a 20 20 20 20 66 72 69 |mplex);.|. fri|
|00002740| 65 6e 64 20 63 6f 6d 70 | 6c 65 78 20 5f 5f 63 6d |end comp|lex __cm|
|00002750| 66 20 6c 6f 67 28 63 6f | 6d 70 6c 65 78 29 3b 20 |f log(co|mplex); |
|00002760| 2f 2f 20 73 61 6d 65 20 | 61 73 20 6c 6e 0d 0a 20 |// same |as ln.. |
|00002770| 20 20 20 66 72 69 65 6e | 64 20 63 6f 6d 70 6c 65 | frien|d comple|
|00002780| 78 20 5f 5f 63 6d 66 20 | 6c 6f 67 32 28 63 6f 6d |x __cmf |log2(com|
|00002790| 70 6c 65 78 29 3b 0d 0a | 20 20 20 20 66 72 69 65 |plex);..| frie|
|000027a0| 6e 64 20 63 6f 6d 70 6c | 65 78 20 5f 5f 63 6d 66 |nd compl|ex __cmf|
|000027b0| 20 6c 6f 67 31 30 28 63 | 6f 6d 70 6c 65 78 29 3b | log10(c|omplex);|
|000027c0| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|000027d0| 70 6c 65 78 20 5f 5f 63 | 6d 66 20 70 6f 77 28 63 |plex __c|mf pow(c|
|000027e0| 6f 6d 70 6c 65 78 20 5f | 62 61 73 65 2c 20 64 6f |omplex _|base, do|
|000027f0| 75 62 6c 65 20 5f 65 78 | 70 6f 52 65 29 3b 0d 0a |uble _ex|poRe);..|
|00002800| 20 20 20 20 66 72 69 65 | 6e 64 20 63 6f 6d 70 6c | frie|nd compl|
|00002810| 65 78 20 5f 5f 63 6d 66 | 20 70 6f 77 52 65 45 78 |ex __cmf| powReEx|
|00002820| 70 6f 28 63 6f 6d 70 6c | 65 78 20 5f 62 61 73 65 |po(compl|ex _base|
|00002830| 2c 20 64 6f 75 62 6c 65 | 20 5f 65 78 70 6f 52 65 |, double| _expoRe|
|00002840| 29 3b 0d 0a 20 20 20 20 | 66 72 69 65 6e 64 20 63 |);.. |friend c|
|00002850| 6f 6d 70 6c 65 78 20 5f | 5f 63 6d 66 20 70 6f 77 |omplex _|_cmf pow|
|00002860| 28 64 6f 75 62 6c 65 20 | 5f 62 61 73 65 52 65 2c |(double |_baseRe,|
|00002870| 20 63 6f 6d 70 6c 65 78 | 20 5f 65 78 70 6f 29 3b | complex| _expo);|
|00002880| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|00002890| 70 6c 65 78 20 5f 5f 63 | 6d 66 20 70 6f 77 52 65 |plex __c|mf powRe|
|000028a0| 42 61 73 65 28 64 6f 75 | 62 6c 65 20 5f 62 61 73 |Base(dou|ble _bas|
|000028b0| 65 52 65 2c 20 63 6f 6d | 70 6c 65 78 20 5f 65 78 |eRe, com|plex _ex|
|000028c0| 70 6f 29 3b 0d 0a 20 20 | 20 20 66 72 69 65 6e 64 |po);.. | friend|
|000028d0| 20 63 6f 6d 70 6c 65 78 | 20 5f 5f 63 6d 66 20 70 | complex| __cmf p|
|000028e0| 6f 77 28 63 6f 6d 70 6c | 65 78 20 5f 62 61 73 65 |ow(compl|ex _base|
|000028f0| 2c 20 63 6f 6d 70 6c 65 | 78 20 5f 65 78 70 6f 29 |, comple|x _expo)|
|00002900| 3b 0d 0a 20 20 20 20 66 | 72 69 65 6e 64 20 63 6f |;.. f|riend co|
|00002910| 6d 70 6c 65 78 20 5f 5f | 63 6d 66 20 71 75 61 72 |mplex __|cmf quar|
|00002920| 74 69 63 28 63 6f 6d 70 | 6c 65 78 29 3b 20 20 2f |tic(comp|lex); /|
|00002930| 2f 20 72 61 69 73 65 20 | 74 6f 20 74 68 65 20 66 |/ raise |to the f|
|00002940| 6f 75 72 74 68 20 70 6f | 77 65 72 0d 0a 20 20 20 |ourth po|wer.. |
|00002950| 20 66 72 69 65 6e 64 20 | 63 6f 6d 70 6c 65 78 20 | friend |complex |
|00002960| 5f 5f 63 6d 66 20 73 69 | 6e 28 63 6f 6d 70 6c 65 |__cmf si|n(comple|
|00002970| 78 29 3b 0d 0a 20 20 20 | 20 66 72 69 65 6e 64 20 |x);.. | friend |
|00002980| 63 6f 6d 70 6c 65 78 20 | 5f 5f 63 6d 66 20 73 69 |complex |__cmf si|
|00002990| 6e 68 28 63 6f 6d 70 6c | 65 78 29 3b 0d 0a 20 20 |nh(compl|ex);.. |
|000029a0| 20 20 66 72 69 65 6e 64 | 20 63 6f 6d 70 6c 65 78 | friend| complex|
|000029b0| 20 5f 5f 63 6d 66 20 73 | 71 72 74 28 63 6f 6d 70 | __cmf s|qrt(comp|
|000029c0| 6c 65 78 29 3b 0d 0a 20 | 20 20 20 66 72 69 65 6e |lex);.. | frien|
|000029d0| 64 20 63 6f 6d 70 6c 65 | 78 20 5f 5f 63 6d 66 20 |d comple|x __cmf |
|000029e0| 73 71 75 61 72 65 28 63 | 6f 6d 70 6c 65 78 29 3b |square(c|omplex);|
|000029f0| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|00002a00| 70 6c 65 78 20 5f 5f 63 | 6d 66 20 74 61 6e 28 63 |plex __c|mf tan(c|
|00002a10| 6f 6d 70 6c 65 78 29 3b | 0d 0a 20 20 20 20 66 72 |omplex);|.. fr|
|00002a20| 69 65 6e 64 20 63 6f 6d | 70 6c 65 78 20 5f 5f 63 |iend com|plex __c|
|00002a30| 6d 66 20 74 61 6e 68 28 | 63 6f 6d 70 6c 65 78 29 |mf tanh(|complex)|
|00002a40| 3b 0d 0a 0d 0a 20 20 20 | 20 66 72 69 65 6e 64 20 |;.... | friend |
|00002a50| 6f 73 74 72 65 61 6d 20 | 5f 56 46 41 52 20 26 20 |ostream |_VFAR & |
|00002a60| 5f 5f 63 6d 66 20 6f 70 | 65 72 61 74 6f 72 3c 3c |__cmf op|erator<<|
|00002a70| 28 6f 73 74 72 65 61 6d | 20 5f 56 46 41 52 20 26 |(ostream| _VFAR &|
|00002a80| 2c 20 63 6f 6d 70 6c 65 | 78 20 5f 56 46 41 52 20 |, comple|x _VFAR |
|00002a90| 26 29 3b 0d 0a 20 20 20 | 20 66 72 69 65 6e 64 20 |&);.. | friend |
|00002aa0| 69 73 74 72 65 61 6d 20 | 5f 56 46 41 52 20 26 20 |istream |_VFAR & |
|00002ab0| 5f 5f 63 6d 66 20 6f 70 | 65 72 61 74 6f 72 3e 3e |__cmf op|erator>>|
|00002ac0| 28 69 73 74 72 65 61 6d | 20 5f 56 46 41 52 20 26 |(istream| _VFAR &|
|00002ad0| 2c 20 63 6f 6d 70 6c 65 | 78 20 5f 56 46 41 52 43 |, comple|x _VFARC|
|00002ae0| 20 26 29 3b 0d 0a 0d 0a | 2f 2f 20 49 6d 70 6c 65 | &);....|// Imple|
|00002af0| 6d 65 6e 74 61 74 69 6f | 6e 0d 0a 20 20 20 20 64 |mentatio|n.. d|
|00002b00| 6f 75 62 6c 65 20 52 65 | 2c 20 49 6d 3b 20 20 20 |ouble Re|, Im; |
|00002b10| 2f 2f 20 73 74 69 6c 6c | 20 70 75 62 6c 69 63 21 |// still| public!|
|00002b20| 0d 0a 7d 3b 0d 0a 23 69 | 66 20 21 64 65 66 69 6e |..};..#i|f !defin|
|00002b30| 65 64 28 20 5f 43 4d 41 | 54 48 5f 44 45 46 53 20 |ed( _CMA|TH_DEFS |
|00002b40| 29 0d 0a 20 20 20 23 64 | 65 66 69 6e 65 20 5f 43 |).. #d|efine _C|
|00002b50| 4d 41 54 48 5f 44 45 46 | 53 0d 0a 20 20 20 74 79 |MATH_DEF|S.. ty|
|00002b60| 70 65 64 65 66 20 73 74 | 72 75 63 74 20 7b 66 6c |pedef st|ruct {fl|
|00002b70| 6f 61 74 20 20 52 65 2c | 20 49 6d 3b 7d 20 66 43 |oat Re,| Im;} fC|
|00002b80| 6f 6d 70 6c 65 78 3b 0d | 0a 20 20 20 74 79 70 65 |omplex;.|. type|
|00002b90| 64 65 66 20 63 6f 6d 70 | 6c 65 78 20 20 64 43 6f |def comp|lex dCo|
|00002ba0| 6d 70 6c 65 78 3b 0d 0a | 20 20 20 23 69 66 64 65 |mplex;..| #ifde|
|00002bb0| 66 20 5f 5f 42 4f 52 4c | 41 4e 44 43 5f 5f 0d 0a |f __BORL|ANDC__..|
|00002bc0| 20 20 20 20 20 20 20 74 | 79 70 65 64 65 66 20 6c | t|ypedef l|
|00002bd0| 6f 6e 67 20 64 6f 75 62 | 6c 65 20 20 65 78 74 65 |ong doub|le exte|
|00002be0| 6e 64 65 64 3b 0d 0a 20 | 20 20 20 20 20 20 74 79 |nded;.. | ty|
|00002bf0| 70 65 64 65 66 20 73 74 | 72 75 63 74 20 7b 65 78 |pedef st|ruct {ex|
|00002c00| 74 65 6e 64 65 64 20 52 | 65 2c 20 49 6d 3b 7d 20 |tended R|e, Im;} |
|00002c10| 65 43 6f 6d 70 6c 65 78 | 3b 0d 0a 20 20 20 23 65 |eComplex|;.. #e|
|00002c20| 6c 73 65 20 2f 2a 20 56 | 69 73 75 61 6c 20 43 2b |lse /* V|isual C+|
|00002c30| 2b 20 2a 2f 0d 0a 20 20 | 20 20 20 20 20 74 79 70 |+ */.. | typ|
|00002c40| 65 64 65 66 20 20 64 6f | 75 62 6c 65 20 65 78 74 |edef do|uble ext|
|00002c50| 65 6e 64 65 64 3b 20 2f | 2a 20 56 69 73 75 61 6c |ended; /|* Visual|
|00002c60| 20 43 2b 2b 20 64 6f 65 | 73 20 6e 6f 74 20 73 75 | C++ doe|s not su|
|00002c70| 70 70 6f 72 74 0d 0a 20 | 20 20 20 20 20 20 20 20 |pport.. | |
|00002c80| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002c90| 20 20 20 20 20 20 20 20 | 38 30 2d 62 69 74 20 49 | |80-bit I|
|00002ca0| 45 45 45 20 6e 75 6d 62 | 65 72 73 2e 20 53 6f 20 |EEE numb|ers. So |
|00002cb0| 6d 61 6b 65 0d 0a 20 20 | 20 20 20 20 20 20 20 20 |make.. | |
|00002cc0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00002cd0| 20 20 20 20 20 20 20 65 | 78 74 65 6e 64 65 64 20 | e|xtended |
|00002ce0| 65 71 75 61 6c 20 74 6f | 20 64 6f 75 62 6c 65 20 |equal to| double |
|00002cf0| 20 20 20 2a 2f 0d 0a 20 | 20 20 20 20 20 20 74 79 | */.. | ty|
|00002d00| 70 65 64 65 66 20 64 43 | 6f 6d 70 6c 65 78 20 20 |pedef dC|omplex |
|00002d10| 65 43 6f 6d 70 6c 65 78 | 3b 0d 0a 20 20 20 23 65 |eComplex|;.. #e|
|00002d20| 6e 64 69 66 20 20 20 20 | 2f 2a 20 72 65 73 74 6f |ndif |/* resto|
|00002d30| 72 65 20 64 65 66 61 75 | 6c 74 20 64 61 74 61 20 |re defau|lt data |
|00002d40| 70 61 63 6b 69 6e 67 20 | 20 2a 2f 0d 0a 23 65 6e |packing | */..#en|
|00002d50| 64 69 66 0d 0a 0d 0a 2f | 2f 20 49 6e 6c 69 6e 65 |dif..../|/ Inline|
|00002d60| 20 69 6d 70 6c 65 6d 65 | 6e 74 61 74 69 6f 6e 20 | impleme|ntation |
|00002d70| 6f 66 20 74 68 65 20 73 | 69 6d 70 6c 65 73 74 20 |of the s|implest |
|00002d80| 66 75 6e 63 74 69 6f 6e | 73 20 61 6e 64 20 6f 70 |function|s and op|
|00002d90| 65 72 61 74 6f 72 73 0d | 0a 2f 2f 20 62 61 73 69 |erators.|.// basi|
|00002da0| 63 20 6f 70 65 72 61 74 | 69 6f 6e 73 3a 0d 0a 69 |c operat|ions:..i|
|00002db0| 6e 6c 69 6e 65 20 63 6f | 6d 70 6c 65 78 20 5f 5f |nline co|mplex __|
|00002dc0| 63 6d 6f 20 63 6f 6e 6a | 28 63 6f 6d 70 6c 65 78 |cmo conj|(complex|
|00002dd0| 20 5f 56 46 41 52 43 20 | 26 20 5f 5f 7a 29 0d 0a | _VFARC |& __z)..|
|00002de0| 7b 20 20 20 20 72 65 74 | 75 72 6e 20 63 6f 6d 70 |{ ret|urn comp|
|00002df0| 6c 65 78 28 5f 5f 7a 2e | 52 65 2c 20 2d 5f 5f 7a |lex(__z.|Re, -__z|
|00002e00| 2e 49 6d 29 3b 20 7d 0d | 0a 0d 0a 69 6e 6c 69 6e |.Im); }.|...inlin|
|00002e10| 65 20 63 6f 6d 70 6c 65 | 78 20 5f 5f 63 6d 6f 20 |e comple|x __cmo |
|00002e20| 6e 65 67 28 63 6f 6d 70 | 6c 65 78 20 5f 56 46 41 |neg(comp|lex _VFA|
|00002e30| 52 43 20 26 20 5f 5f 7a | 29 0d 0a 7b 20 20 20 20 |RC & __z|)..{ |
|00002e40| 72 65 74 75 72 6e 20 63 | 6f 6d 70 6c 65 78 28 2d |return c|omplex(-|
|00002e50| 5f 5f 7a 2e 52 65 2c 20 | 2d 5f 5f 7a 2e 49 6d 29 |__z.Re, |-__z.Im)|
|00002e60| 3b 20 7d 0d 0a 0d 0a 2f | 2f 20 75 6e 61 72 79 20 |; }..../|/ unary |
|00002e70| 6f 70 65 72 61 74 6f 72 | 73 3a 0d 0a 69 6e 6c 69 |operator|s:..inli|
|00002e80| 6e 65 20 63 6f 6d 70 6c | 65 78 20 5f 56 46 41 52 |ne compl|ex _VFAR|
|00002e90| 20 26 20 5f 5f 63 6d 6f | 20 63 6f 6d 70 6c 65 78 | & __cmo| complex|
|00002ea0| 3a 3a 6f 70 65 72 61 74 | 6f 72 2b 28 29 0d 0a 7b |::operat|or+()..{|
|00002eb0| 20 20 20 20 72 65 74 75 | 72 6e 20 2a 74 68 69 73 | retu|rn *this|
|00002ec0| 3b 20 7d 0d 0a 0d 0a 69 | 6e 6c 69 6e 65 20 63 6f |; }....i|nline co|
|00002ed0| 6d 70 6c 65 78 20 5f 56 | 46 41 52 20 26 20 5f 5f |mplex _V|FAR & __|
|00002ee0| 63 6d 66 20 6f 70 65 72 | 61 74 6f 72 2d 28 20 63 |cmf oper|ator-( c|
|00002ef0| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 43 20 26 20 |omplex _|VFARC & |
|00002f00| 5f 5f 7a 29 0d 0a 7b 20 | 20 20 20 72 65 74 75 72 |__z)..{ | retur|
|00002f10| 6e 20 63 6f 6d 70 6c 65 | 78 28 2d 5f 5f 7a 2e 52 |n comple|x(-__z.R|
|00002f20| 65 2c 20 2d 5f 5f 7a 2e | 49 6d 29 3b 20 7d 0d 0a |e, -__z.|Im); }..|
|00002f30| 0d 0a 0d 0a 2f 2f 20 62 | 69 6e 61 72 79 20 6f 70 |....// b|inary op|
|00002f40| 65 72 61 74 6f 72 73 3a | 0d 0a 69 6e 6c 69 6e 65 |erators:|..inline|
|00002f50| 20 63 6f 6d 70 6c 65 78 | 20 5f 5f 63 6d 6f 20 6f | complex| __cmo o|
|00002f60| 70 65 72 61 74 6f 72 2b | 28 63 6f 6d 70 6c 65 78 |perator+|(complex|
|00002f70| 20 5f 56 46 41 52 43 20 | 26 20 5f 5f 7a 31 2c 20 | _VFARC |& __z1, |
|00002f80| 63 6f 6d 70 6c 65 78 20 | 5f 56 46 41 52 43 20 26 |complex |_VFARC &|
|00002f90| 20 5f 5f 7a 32 29 0d 0a | 7b 20 20 20 20 72 65 74 | __z2)..|{ ret|
|00002fa0| 75 72 6e 20 63 6f 6d 70 | 6c 65 78 28 5f 5f 7a 31 |urn comp|lex(__z1|
|00002fb0| 2e 52 65 20 2b 20 5f 5f | 7a 32 2e 52 65 2c 20 5f |.Re + __|z2.Re, _|
|00002fc0| 5f 7a 31 2e 49 6d 20 2b | 20 5f 5f 7a 32 2e 49 6d |_z1.Im +| __z2.Im|
|00002fd0| 29 3b 20 7d 0d 0a 0d 0a | 69 6e 6c 69 6e 65 20 63 |); }....|inline c|
|00002fe0| 6f 6d 70 6c 65 78 20 5f | 5f 63 6d 6f 20 6f 70 65 |omplex _|_cmo ope|
|00002ff0| 72 61 74 6f 72 2b 28 64 | 6f 75 62 6c 65 20 5f 5f |rator+(d|ouble __|
|00003000| 7a 31 52 65 2c 20 63 6f | 6d 70 6c 65 78 20 5f 56 |z1Re, co|mplex _V|
|00003010| 46 41 52 43 20 26 20 5f | 5f 7a 32 29 0d 0a 7b 20 |FARC & _|_z2)..{ |
|00003020| 20 20 20 72 65 74 75 72 | 6e 20 63 6f 6d 70 6c 65 | retur|n comple|
|00003030| 78 28 5f 5f 7a 31 52 65 | 20 2b 20 5f 5f 7a 32 2e |x(__z1Re| + __z2.|
|00003040| 52 65 2c 20 5f 5f 7a 32 | 2e 49 6d 29 3b 20 7d 0d |Re, __z2|.Im); }.|
|00003050| 0a 0d 0a 69 6e 6c 69 6e | 65 20 63 6f 6d 70 6c 65 |...inlin|e comple|
|00003060| 78 20 5f 5f 63 6d 6f 20 | 6f 70 65 72 61 74 6f 72 |x __cmo |operator|
|00003070| 2b 28 63 6f 6d 70 6c 65 | 78 20 5f 56 46 41 52 43 |+(comple|x _VFARC|
|00003080| 20 26 20 5f 5f 7a 31 2c | 20 64 6f 75 62 6c 65 20 | & __z1,| double |
|00003090| 5f 5f 7a 32 52 65 29 0d | 0a 7b 20 20 20 20 72 65 |__z2Re).|.{ re|
|000030a0| 74 75 72 6e 20 63 6f 6d | 70 6c 65 78 28 5f 5f 7a |turn com|plex(__z|
|000030b0| 31 2e 52 65 20 2b 20 5f | 5f 7a 32 52 65 2c 20 5f |1.Re + _|_z2Re, _|
|000030c0| 5f 7a 31 2e 49 6d 29 3b | 20 7d 0d 0a 0d 0a 69 6e |_z1.Im);| }....in|
|000030d0| 6c 69 6e 65 20 63 6f 6d | 70 6c 65 78 20 5f 5f 63 |line com|plex __c|
|000030e0| 6d 6f 20 6f 70 65 72 61 | 74 6f 72 2d 28 63 6f 6d |mo opera|tor-(com|
|000030f0| 70 6c 65 78 20 5f 56 46 | 41 52 43 20 26 20 5f 5f |plex _VF|ARC & __|
|00003100| 7a 31 2c 20 63 6f 6d 70 | 6c 65 78 20 5f 56 46 41 |z1, comp|lex _VFA|
|00003110| 52 43 20 26 20 5f 5f 7a | 32 29 0d 0a 7b 20 20 20 |RC & __z|2)..{ |
|00003120| 20 72 65 74 75 72 6e 20 | 63 6f 6d 70 6c 65 78 28 | return |complex(|
|00003130| 5f 5f 7a 31 2e 52 65 20 | 2d 20 5f 5f 7a 32 2e 52 |__z1.Re |- __z2.R|
|00003140| 65 2c 20 5f 5f 7a 31 2e | 49 6d 20 2d 20 5f 5f 7a |e, __z1.|Im - __z|
|00003150| 32 2e 49 6d 29 3b 20 7d | 0d 0a 0d 0a 69 6e 6c 69 |2.Im); }|....inli|
|00003160| 6e 65 20 63 6f 6d 70 6c | 65 78 20 5f 5f 63 6d 6f |ne compl|ex __cmo|
|00003170| 20 6f 70 65 72 61 74 6f | 72 2d 28 64 6f 75 62 6c | operato|r-(doubl|
|00003180| 65 20 5f 5f 7a 31 52 65 | 2c 20 63 6f 6d 70 6c 65 |e __z1Re|, comple|
|00003190| 78 20 5f 56 46 41 52 43 | 20 26 20 5f 5f 7a 32 29 |x _VFARC| & __z2)|
|000031a0| 0d 0a 7b 20 20 20 20 72 | 65 74 75 72 6e 20 63 6f |..{ r|eturn co|
|000031b0| 6d 70 6c 65 78 28 5f 5f | 7a 31 52 65 20 2d 20 5f |mplex(__|z1Re - _|
|000031c0| 5f 7a 32 2e 52 65 2c 20 | 2d 5f 5f 7a 32 2e 49 6d |_z2.Re, |-__z2.Im|
|000031d0| 29 3b 20 7d 0d 0a 0d 0a | 69 6e 6c 69 6e 65 20 63 |); }....|inline c|
|000031e0| 6f 6d 70 6c 65 78 20 5f | 5f 63 6d 6f 20 6f 70 65 |omplex _|_cmo ope|
|000031f0| 72 61 74 6f 72 2d 28 63 | 6f 6d 70 6c 65 78 20 5f |rator-(c|omplex _|
|00003200| 56 46 41 52 43 20 26 20 | 5f 5f 7a 31 2c 20 64 6f |VFARC & |__z1, do|
|00003210| 75 62 6c 65 20 5f 5f 7a | 32 52 65 29 0d 0a 7b 20 |uble __z|2Re)..{ |
|00003220| 20 20 20 72 65 74 75 72 | 6e 20 63 6f 6d 70 6c 65 | retur|n comple|
|00003230| 78 28 5f 5f 7a 31 2e 52 | 65 20 2d 20 5f 5f 7a 32 |x(__z1.R|e - __z2|
|00003240| 52 65 2c 20 5f 5f 7a 31 | 2e 49 6d 29 3b 20 7d 0d |Re, __z1|.Im); }.|
|00003250| 0a 0d 0a 69 6e 6c 69 6e | 65 20 63 6f 6d 70 6c 65 |...inlin|e comple|
|00003260| 78 20 5f 5f 63 6d 6f 20 | 6f 70 65 72 61 74 6f 72 |x __cmo |operator|
|00003270| 2a 28 63 6f 6d 70 6c 65 | 78 20 5f 56 46 41 52 43 |*(comple|x _VFARC|
|00003280| 20 26 20 5f 5f 7a 31 2c | 20 63 6f 6d 70 6c 65 78 | & __z1,| complex|
|00003290| 20 5f 56 46 41 52 43 20 | 26 20 5f 5f 7a 32 29 0d | _VFARC |& __z2).|
|000032a0| 0a 7b 20 20 20 72 65 74 | 75 72 6e 20 63 6f 6d 70 |.{ ret|urn comp|
|000032b0| 6c 65 78 28 20 5f 5f 7a | 31 2e 52 65 20 2a 20 5f |lex( __z|1.Re * _|
|000032c0| 5f 7a 32 2e 52 65 20 2d | 20 5f 5f 7a 31 2e 49 6d |_z2.Re -| __z1.Im|
|000032d0| 20 2a 20 5f 5f 7a 32 2e | 49 6d 2c 0d 0a 20 20 20 | * __z2.|Im,.. |
|000032e0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000032f0| 20 5f 5f 7a 31 2e 52 65 | 20 2a 20 5f 5f 7a 32 2e | __z1.Re| * __z2.|
|00003300| 49 6d 20 2b 20 5f 5f 7a | 31 2e 49 6d 20 2a 20 5f |Im + __z|1.Im * _|
|00003310| 5f 7a 32 2e 52 65 20 29 | 3b 0d 0a 7d 0d 0a 0d 0a |_z2.Re )|;..}....|
|00003320| 69 6e 6c 69 6e 65 20 63 | 6f 6d 70 6c 65 78 20 5f |inline c|omplex _|
|00003330| 5f 63 6d 6f 20 6f 70 65 | 72 61 74 6f 72 2a 28 63 |_cmo ope|rator*(c|
|00003340| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 43 20 26 20 |omplex _|VFARC & |
|00003350| 5f 5f 7a 31 2c 20 64 6f | 75 62 6c 65 20 5f 5f 7a |__z1, do|uble __z|
|00003360| 32 52 65 29 0d 0a 7b 20 | 20 20 20 72 65 74 75 72 |2Re)..{ | retur|
|00003370| 6e 20 63 6f 6d 70 6c 65 | 78 28 5f 5f 7a 31 2e 52 |n comple|x(__z1.R|
|00003380| 65 2a 5f 5f 7a 32 52 65 | 2c 20 5f 5f 7a 31 2e 49 |e*__z2Re|, __z1.I|
|00003390| 6d 2a 5f 5f 7a 32 52 65 | 29 3b 20 7d 0d 0a 0d 0a |m*__z2Re|); }....|
|000033a0| 69 6e 6c 69 6e 65 20 63 | 6f 6d 70 6c 65 78 20 5f |inline c|omplex _|
|000033b0| 5f 63 6d 6f 20 6f 70 65 | 72 61 74 6f 72 2a 28 64 |_cmo ope|rator*(d|
|000033c0| 6f 75 62 6c 65 20 5f 5f | 7a 31 52 65 2c 20 63 6f |ouble __|z1Re, co|
|000033d0| 6d 70 6c 65 78 20 5f 56 | 46 41 52 43 20 26 20 5f |mplex _V|FARC & _|
|000033e0| 5f 7a 32 29 0d 0a 7b 20 | 20 20 20 72 65 74 75 72 |_z2)..{ | retur|
|000033f0| 6e 20 63 6f 6d 70 6c 65 | 78 28 5f 5f 7a 32 2e 52 |n comple|x(__z2.R|
|00003400| 65 2a 5f 5f 7a 31 52 65 | 2c 20 5f 5f 7a 32 2e 49 |e*__z1Re|, __z2.I|
|00003410| 6d 2a 5f 5f 7a 31 52 65 | 29 3b 20 7d 0d 0a 0d 0a |m*__z1Re|); }....|
|00003420| 69 6e 6c 69 6e 65 20 63 | 6f 6d 70 6c 65 78 20 5f |inline c|omplex _|
|00003430| 5f 63 6d 6f 20 6f 70 65 | 72 61 74 6f 72 20 2f 28 |_cmo ope|rator /(|
|00003440| 63 6f 6d 70 6c 65 78 20 | 5f 56 46 41 52 43 20 26 |complex |_VFARC &|
|00003450| 20 5f 5f 64 69 76 69 64 | 65 6e 64 2c 0d 0a 20 20 | __divid|end,.. |
|00003460| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003470| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 63 6f | | co|
|00003480| 6d 70 6c 65 78 20 5f 56 | 46 41 52 43 20 26 20 5f |mplex _V|FARC & _|
|00003490| 5f 64 69 76 69 73 6f 72 | 20 29 0d 0a 7b 20 20 20 |_divisor| )..{ |
|000034a0| 20 20 63 6f 6d 70 6c 65 | 78 20 20 20 20 20 52 65 | comple|x Re|
|000034b0| 73 75 6c 74 3b 0d 0a 20 | 20 20 20 20 20 6c 6f 6e |sult;.. | lon|
|000034c0| 67 20 64 6f 75 62 6c 65 | 20 64 65 6e 6f 6d 3b 0d |g double| denom;.|
|000034d0| 0a 20 20 20 20 20 20 52 | 65 73 75 6c 74 2e 52 65 |. R|esult.Re|
|000034e0| 20 3d 20 28 64 6f 75 62 | 6c 65 29 28 28 5f 5f 64 | = (doub|le)((__d|
|000034f0| 69 76 69 64 65 6e 64 2e | 52 65 20 2a 5f 5f 64 69 |ividend.|Re *__di|
|00003500| 76 69 73 6f 72 2e 52 65 | 20 2b 0d 0a 20 20 20 20 |visor.Re| +.. |
|00003510| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003520| 20 20 20 20 20 20 20 20 | 5f 5f 64 69 76 69 64 65 | |__divide|
|00003530| 6e 64 2e 49 6d 20 2a 5f | 5f 64 69 76 69 73 6f 72 |nd.Im *_|_divisor|
|00003540| 2e 49 6d 29 20 2f 0d 0a | 20 20 20 20 20 20 20 20 |.Im) /..| |
|00003550| 20 28 64 65 6e 6f 6d 20 | 3d 20 28 6c 6f 6e 67 20 | (denom |= (long |
|00003560| 64 6f 75 62 6c 65 29 28 | 5f 5f 64 69 76 69 73 6f |double)(|__diviso|
|00003570| 72 2e 52 65 29 20 2a 20 | 5f 5f 64 69 76 69 73 6f |r.Re) * |__diviso|
|00003580| 72 2e 52 65 20 2b 0d 0a | 20 20 20 20 20 20 20 20 |r.Re +..| |
|00003590| 20 20 20 20 20 20 20 20 | 20 20 28 6c 6f 6e 67 20 | | (long |
|000035a0| 64 6f 75 62 6c 65 29 28 | 5f 5f 64 69 76 69 73 6f |double)(|__diviso|
|000035b0| 72 2e 49 6d 29 20 2a 20 | 5f 5f 64 69 76 69 73 6f |r.Im) * |__diviso|
|000035c0| 72 2e 49 6d 29 29 3b 0d | 0a 20 20 20 20 20 20 52 |r.Im));.|. R|
|000035d0| 65 73 75 6c 74 2e 49 6d | 20 3d 20 28 64 6f 75 62 |esult.Im| = (doub|
|000035e0| 6c 65 29 28 28 5f 5f 64 | 69 76 69 64 65 6e 64 2e |le)((__d|ividend.|
|000035f0| 49 6d 20 2a 20 5f 5f 64 | 69 76 69 73 6f 72 2e 52 |Im * __d|ivisor.R|
|00003600| 65 20 2d 0d 0a 20 20 20 | 20 20 20 20 20 20 20 20 |e -.. | |
|00003610| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00003620| 20 5f 5f 64 69 76 69 64 | 65 6e 64 2e 52 65 20 2a | __divid|end.Re *|
|00003630| 20 5f 5f 64 69 76 69 73 | 6f 72 2e 49 6d 20 29 20 | __divis|or.Im ) |
|00003640| 2f 20 64 65 6e 6f 6d 29 | 3b 0d 0a 20 20 20 20 20 |/ denom)|;.. |
|00003650| 20 72 65 74 75 72 6e 20 | 52 65 73 75 6c 74 3b 0d | return |Result;.|
|00003660| 0a 7d 0d 0a 0d 0a 69 6e | 6c 69 6e 65 20 63 6f 6d |.}....in|line com|
|00003670| 70 6c 65 78 20 5f 5f 63 | 6d 6f 20 6f 70 65 72 61 |plex __c|mo opera|
|00003680| 74 6f 72 2f 28 63 6f 6d | 70 6c 65 78 20 5f 56 46 |tor/(com|plex _VF|
|00003690| 41 52 43 20 26 20 5f 5f | 64 69 76 69 64 65 6e 64 |ARC & __|dividend|
|000036a0| 2c 20 64 6f 75 62 6c 65 | 20 5f 5f 64 69 76 69 73 |, double| __divis|
|000036b0| 6f 72 52 65 29 0d 0a 7b | 20 20 20 20 72 65 74 75 |orRe)..{| retu|
|000036c0| 72 6e 20 63 6f 6d 70 6c | 65 78 28 5f 5f 64 69 76 |rn compl|ex(__div|
|000036d0| 69 64 65 6e 64 2e 52 65 | 2f 5f 5f 64 69 76 69 73 |idend.Re|/__divis|
|000036e0| 6f 72 52 65 2c 20 5f 5f | 64 69 76 69 64 65 6e 64 |orRe, __|dividend|
|000036f0| 2e 49 6d 2f 5f 5f 64 69 | 76 69 73 6f 72 52 65 29 |.Im/__di|visorRe)|
|00003700| 3b 20 7d 0d 0a 0d 0a 69 | 6e 6c 69 6e 65 20 63 6f |; }....i|nline co|
|00003710| 6d 70 6c 65 78 20 5f 5f | 63 6d 6f 20 6f 70 65 72 |mplex __|cmo oper|
|00003720| 61 74 6f 72 20 2f 28 20 | 64 6f 75 62 6c 65 20 5f |ator /( |double _|
|00003730| 5f 64 69 76 69 64 65 6e | 64 52 65 2c 20 63 6f 6d |_dividen|dRe, com|
|00003740| 70 6c 65 78 20 5f 56 46 | 41 52 43 20 26 20 5f 5f |plex _VF|ARC & __|
|00003750| 64 69 76 69 73 6f 72 20 | 29 0d 0a 7b 20 20 20 20 |divisor |)..{ |
|00003760| 20 63 6f 6d 70 6c 65 78 | 20 20 20 20 20 52 65 73 | complex| Res|
|00003770| 75 6c 74 3b 0d 0a 20 20 | 20 20 20 20 6c 6f 6e 67 |ult;.. | long|
|00003780| 20 64 6f 75 62 6c 65 20 | 64 65 6e 6f 6d 3b 0d 0a | double |denom;..|
|00003790| 20 20 20 20 20 20 52 65 | 73 75 6c 74 2e 52 65 20 | Re|sult.Re |
|000037a0| 3d 20 28 64 6f 75 62 6c | 65 29 28 28 5f 5f 64 69 |= (doubl|e)((__di|
|000037b0| 76 69 64 65 6e 64 52 65 | 20 2a 20 5f 5f 64 69 76 |videndRe| * __div|
|000037c0| 69 73 6f 72 2e 52 65 29 | 20 2f 0d 0a 20 20 20 20 |isor.Re)| /.. |
|000037d0| 20 20 20 20 20 28 64 65 | 6e 6f 6d 20 3d 20 28 6c | (de|nom = (l|
|000037e0| 6f 6e 67 20 64 6f 75 62 | 6c 65 29 28 5f 5f 64 69 |ong doub|le)(__di|
|000037f0| 76 69 73 6f 72 2e 52 65 | 29 20 2a 20 5f 5f 64 69 |visor.Re|) * __di|
|00003800| 76 69 73 6f 72 2e 52 65 | 20 2b 0d 0a 20 20 20 20 |visor.Re| +.. |
|00003810| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 28 6c | | (l|
|00003820| 6f 6e 67 20 64 6f 75 62 | 6c 65 29 28 5f 5f 64 69 |ong doub|le)(__di|
|00003830| 76 69 73 6f 72 2e 49 6d | 29 20 2a 20 5f 5f 64 69 |visor.Im|) * __di|
|00003840| 76 69 73 6f 72 2e 49 6d | 29 29 3b 0d 0a 20 20 20 |visor.Im|));.. |
|00003850| 20 20 20 52 65 73 75 6c | 74 2e 49 6d 20 3d 20 2d | Resul|t.Im = -|
|00003860| 28 64 6f 75 62 6c 65 29 | 28 28 5f 5f 64 69 76 69 |(double)|((__divi|
|00003870| 64 65 6e 64 52 65 20 2a | 20 5f 5f 64 69 76 69 73 |dendRe *| __divis|
|00003880| 6f 72 2e 49 6d 20 29 20 | 2f 20 64 65 6e 6f 6d 29 |or.Im ) |/ denom)|
|00003890| 3b 0d 0a 20 20 20 20 20 | 20 72 65 74 75 72 6e 20 |;.. | return |
|000038a0| 52 65 73 75 6c 74 3b 0d | 0a 7d 0d 0a 0d 0a 69 6e |Result;.|.}....in|
|000038b0| 6c 69 6e 65 20 63 6f 6d | 70 6c 65 78 20 5f 56 46 |line com|plex _VF|
|000038c0| 41 52 20 26 20 5f 5f 63 | 6d 6f 20 63 6f 6d 70 6c |AR & __c|mo compl|
|000038d0| 65 78 3a 3a 6f 70 65 72 | 61 74 6f 72 2b 3d 28 63 |ex::oper|ator+=(c|
|000038e0| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 43 20 26 20 |omplex _|VFARC & |
|000038f0| 5f 5f 7a 32 29 0d 0a 7b | 20 20 20 52 65 20 2b 3d |__z2)..{| Re +=|
|00003900| 20 5f 5f 7a 32 2e 52 65 | 3b 0d 0a 20 20 20 20 49 | __z2.Re|;.. I|
|00003910| 6d 20 2b 3d 20 5f 5f 7a | 32 2e 49 6d 3b 0d 0a 20 |m += __z|2.Im;.. |
|00003920| 20 20 20 72 65 74 75 72 | 6e 20 2a 74 68 69 73 3b | retur|n *this;|
|00003930| 0d 0a 7d 0d 0a 0d 0a 69 | 6e 6c 69 6e 65 20 63 6f |..}....i|nline co|
|00003940| 6d 70 6c 65 78 20 5f 56 | 46 41 52 20 26 20 5f 5f |mplex _V|FAR & __|
|00003950| 63 6d 6f 20 63 6f 6d 70 | 6c 65 78 3a 3a 6f 70 65 |cmo comp|lex::ope|
|00003960| 72 61 74 6f 72 2b 3d 28 | 64 6f 75 62 6c 65 20 5f |rator+=(|double _|
|00003970| 5f 7a 32 52 65 29 0d 0a | 7b 20 20 20 52 65 20 2b |_z2Re)..|{ Re +|
|00003980| 3d 20 5f 5f 7a 32 52 65 | 3b 0d 0a 20 20 20 20 72 |= __z2Re|;.. r|
|00003990| 65 74 75 72 6e 20 2a 74 | 68 69 73 3b 0d 0a 7d 0d |eturn *t|his;..}.|
|000039a0| 0a 0d 0a 69 6e 6c 69 6e | 65 20 63 6f 6d 70 6c 65 |...inlin|e comple|
|000039b0| 78 20 5f 56 46 41 52 20 | 26 20 5f 5f 63 6d 6f 20 |x _VFAR |& __cmo |
|000039c0| 63 6f 6d 70 6c 65 78 3a | 3a 6f 70 65 72 61 74 6f |complex:|:operato|
|000039d0| 72 2d 3d 28 63 6f 6d 70 | 6c 65 78 20 5f 56 46 41 |r-=(comp|lex _VFA|
|000039e0| 52 43 20 26 20 5f 5f 7a | 32 29 0d 0a 7b 20 20 20 |RC & __z|2)..{ |
|000039f0| 52 65 20 2d 3d 20 5f 5f | 7a 32 2e 52 65 3b 0d 0a |Re -= __|z2.Re;..|
|00003a00| 20 20 20 20 49 6d 20 2d | 3d 20 5f 5f 7a 32 2e 49 | Im -|= __z2.I|
|00003a10| 6d 3b 0d 0a 20 20 20 20 | 72 65 74 75 72 6e 20 2a |m;.. |return *|
|00003a20| 74 68 69 73 3b 0d 0a 7d | 0d 0a 0d 0a 69 6e 6c 69 |this;..}|....inli|
|00003a30| 6e 65 20 63 6f 6d 70 6c | 65 78 20 5f 56 46 41 52 |ne compl|ex _VFAR|
|00003a40| 20 26 20 5f 5f 63 6d 6f | 20 63 6f 6d 70 6c 65 78 | & __cmo| complex|
|00003a50| 3a 3a 6f 70 65 72 61 74 | 6f 72 2d 3d 28 64 6f 75 |::operat|or-=(dou|
|00003a60| 62 6c 65 20 5f 5f 7a 32 | 52 65 29 0d 0a 7b 20 20 |ble __z2|Re)..{ |
|00003a70| 20 52 65 20 2d 3d 20 5f | 5f 7a 32 52 65 3b 0d 0a | Re -= _|_z2Re;..|
|00003a80| 20 20 20 20 72 65 74 75 | 72 6e 20 2a 74 68 69 73 | retu|rn *this|
|00003a90| 3b 0d 0a 7d 0d 0a 0d 0a | 69 6e 6c 69 6e 65 20 63 |;..}....|inline c|
|00003aa0| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 20 26 20 5f |omplex _|VFAR & _|
|00003ab0| 5f 63 6d 6f 20 63 6f 6d | 70 6c 65 78 3a 3a 6f 70 |_cmo com|plex::op|
|00003ac0| 65 72 61 74 6f 72 2a 3d | 28 64 6f 75 62 6c 65 20 |erator*=|(double |
|00003ad0| 5f 5f 7a 32 52 65 29 0d | 0a 7b 20 20 20 52 65 20 |__z2Re).|.{ Re |
|00003ae0| 2a 3d 20 5f 5f 7a 32 52 | 65 3b 0d 0a 20 20 20 20 |*= __z2R|e;.. |
|00003af0| 49 6d 20 2a 3d 20 5f 5f | 7a 32 52 65 3b 0d 0a 20 |Im *= __|z2Re;.. |
|00003b00| 20 20 20 72 65 74 75 72 | 6e 20 2a 74 68 69 73 3b | retur|n *this;|
|00003b10| 0d 0a 7d 0d 0a 0d 0a 69 | 6e 6c 69 6e 65 20 63 6f |..}....i|nline co|
|00003b20| 6d 70 6c 65 78 20 5f 56 | 46 41 52 20 26 20 5f 5f |mplex _V|FAR & __|
|00003b30| 63 6d 6f 20 63 6f 6d 70 | 6c 65 78 3a 3a 6f 70 65 |cmo comp|lex::ope|
|00003b40| 72 61 74 6f 72 20 2a 3d | 28 63 6f 6d 70 6c 65 78 |rator *=|(complex|
|00003b50| 20 5f 56 46 41 52 43 20 | 26 20 5f 5f 7a 32 29 0d | _VFARC |& __z2).|
|00003b60| 0a 7b 20 20 20 20 20 64 | 6f 75 62 6c 65 20 74 6d |.{ d|ouble tm|
|00003b70| 70 52 65 20 3d 20 52 65 | 20 2a 20 5f 5f 7a 32 2e |pRe = Re| * __z2.|
|00003b80| 52 65 20 2d 20 49 6d 20 | 2a 20 5f 5f 7a 32 2e 49 |Re - Im |* __z2.I|
|00003b90| 6d 3b 0d 0a 20 20 20 20 | 20 20 20 20 20 20 20 20 |m;.. | |
|00003ba0| 20 49 6d 20 20 20 20 3d | 20 52 65 20 2a 20 5f 5f | Im =| Re * __|
|00003bb0| 7a 32 2e 49 6d 20 2b 20 | 49 6d 20 2a 20 5f 5f 7a |z2.Im + |Im * __z|
|00003bc0| 32 2e 52 65 3b 0d 0a 20 | 20 20 20 20 20 52 65 20 |2.Re;.. | Re |
|00003bd0| 3d 20 74 6d 70 52 65 3b | 0d 0a 20 20 20 20 20 20 |= tmpRe;|.. |
|00003be0| 72 65 74 75 72 6e 20 2a | 74 68 69 73 3b 0d 0a 7d |return *|this;..}|
|00003bf0| 0d 0a 0d 0a 69 6e 6c 69 | 6e 65 20 63 6f 6d 70 6c |....inli|ne compl|
|00003c00| 65 78 20 5f 56 46 41 52 | 20 26 20 5f 5f 63 6d 6f |ex _VFAR| & __cmo|
|00003c10| 20 63 6f 6d 70 6c 65 78 | 3a 3a 6f 70 65 72 61 74 | complex|::operat|
|00003c20| 6f 72 20 2f 3d 28 20 63 | 6f 6d 70 6c 65 78 20 5f |or /=( c|omplex _|
|00003c30| 56 46 41 52 43 20 26 20 | 5f 5f 64 69 76 69 73 6f |VFARC & |__diviso|
|00003c40| 72 20 29 0d 0a 7b 20 20 | 20 20 20 6c 6f 6e 67 20 |r )..{ | long |
|00003c50| 64 6f 75 62 6c 65 20 64 | 65 6e 6f 6d 3b 0d 0a 20 |double d|enom;.. |
|00003c60| 20 20 20 20 20 64 6f 75 | 62 6c 65 20 74 6d 70 52 | dou|ble tmpR|
|00003c70| 65 20 3d 20 28 64 6f 75 | 62 6c 65 29 28 28 52 65 |e = (dou|ble)((Re|
|00003c80| 20 2a 20 5f 5f 64 69 76 | 69 73 6f 72 2e 52 65 20 | * __div|isor.Re |
|00003c90| 2b 20 49 6d 20 2a 20 5f | 5f 64 69 76 69 73 6f 72 |+ Im * _|_divisor|
|00003ca0| 2e 49 6d 29 20 2f 0d 0a | 20 20 20 20 20 20 20 20 |.Im) /..| |
|00003cb0| 28 64 65 6e 6f 6d 20 3d | 20 28 6c 6f 6e 67 20 64 |(denom =| (long d|
|00003cc0| 6f 75 62 6c 65 29 28 5f | 5f 64 69 76 69 73 6f 72 |ouble)(_|_divisor|
|00003cd0| 2e 52 65 29 20 2a 20 5f | 5f 64 69 76 69 73 6f 72 |.Re) * _|_divisor|
|00003ce0| 2e 52 65 20 2b 0d 0a 20 | 20 20 20 20 20 20 20 20 |.Re +.. | |
|00003cf0| 20 20 20 20 20 20 20 20 | 28 6c 6f 6e 67 20 64 6f | |(long do|
|00003d00| 75 62 6c 65 29 28 5f 5f | 64 69 76 69 73 6f 72 2e |uble)(__|divisor.|
|00003d10| 49 6d 29 20 2a 20 5f 5f | 64 69 76 69 73 6f 72 2e |Im) * __|divisor.|
|00003d20| 49 6d 29 29 3b 0d 0a 20 | 20 20 20 20 20 49 6d 20 |Im));.. | Im |
|00003d30| 3d 20 28 49 6d 20 2a 20 | 5f 5f 64 69 76 69 73 6f |= (Im * |__diviso|
|00003d40| 72 2e 52 65 20 2d 20 52 | 65 20 2a 20 5f 5f 64 69 |r.Re - R|e * __di|
|00003d50| 76 69 73 6f 72 2e 49 6d | 20 29 20 2f 20 64 65 6e |visor.Im| ) / den|
|00003d60| 6f 6d 3b 0d 0a 20 20 20 | 20 20 20 52 65 20 3d 20 |om;.. | Re = |
|00003d70| 74 6d 70 52 65 3b 0d 0a | 20 20 20 20 20 20 72 65 |tmpRe;..| re|
|00003d80| 74 75 72 6e 20 2a 74 68 | 69 73 3b 0d 0a 7d 0d 0a |turn *th|is;..}..|
|00003d90| 0d 0a 69 6e 6c 69 6e 65 | 20 63 6f 6d 70 6c 65 78 |..inline| complex|
|00003da0| 20 5f 56 46 41 52 20 26 | 20 5f 5f 63 6d 6f 20 63 | _VFAR &| __cmo c|
|00003db0| 6f 6d 70 6c 65 78 3a 3a | 6f 70 65 72 61 74 6f 72 |omplex::|operator|
|00003dc0| 2f 3d 28 64 6f 75 62 6c | 65 20 5f 5f 7a 32 52 65 |/=(doubl|e __z2Re|
|00003dd0| 29 0d 0a 7b 20 20 20 52 | 65 20 2f 3d 20 5f 5f 7a |)..{ R|e /= __z|
|00003de0| 32 52 65 3b 0d 0a 20 20 | 20 20 49 6d 20 2f 3d 20 |2Re;.. | Im /= |
|00003df0| 5f 5f 7a 32 52 65 3b 0d | 0a 20 20 20 20 72 65 74 |__z2Re;.|. ret|
|00003e00| 75 72 6e 20 2a 74 68 69 | 73 3b 0d 0a 7d 0d 0a 0d |urn *thi|s;..}...|
|00003e10| 0a 69 6e 6c 69 6e 65 20 | 56 42 4f 4f 4c 20 5f 5f |.inline |VBOOL __|
|00003e20| 63 6d 6f 20 6f 70 65 72 | 61 74 6f 72 3d 3d 28 63 |cmo oper|ator==(c|
|00003e30| 6f 6d 70 6c 65 78 20 5f | 56 46 41 52 43 20 26 20 |omplex _|VFARC & |
|00003e40| 5f 5f 7a 31 2c 20 63 6f | 6d 70 6c 65 78 20 5f 56 |__z1, co|mplex _V|
|00003e50| 46 41 52 43 20 26 20 5f | 5f 7a 32 29 0d 0a 7b 20 |FARC & _|_z2)..{ |
|00003e60| 20 20 72 65 74 75 72 6e | 20 5f 5f 7a 31 2e 52 65 | return| __z1.Re|
|00003e70| 20 3d 3d 20 5f 5f 7a 32 | 2e 52 65 20 26 26 20 5f | == __z2|.Re && _|
|00003e80| 5f 7a 31 2e 49 6d 20 3d | 3d 20 5f 5f 7a 32 2e 49 |_z1.Im =|= __z2.I|
|00003e90| 6d 3b 20 7d 0d 0a 0d 0a | 69 6e 6c 69 6e 65 20 56 |m; }....|inline V|
|00003ea0| 42 4f 4f 4c 20 5f 5f 63 | 6d 6f 20 6f 70 65 72 61 |BOOL __c|mo opera|
|00003eb0| 74 6f 72 3d 3d 28 63 6f | 6d 70 6c 65 78 20 5f 56 |tor==(co|mplex _V|
|00003ec0| 46 41 52 43 20 26 20 5f | 5f 7a 31 2c 20 64 6f 75 |FARC & _|_z1, dou|
|00003ed0| 62 6c 65 20 5f 5f 7a 32 | 52 65 29 0d 0a 7b 20 20 |ble __z2|Re)..{ |
|00003ee0| 20 72 65 74 75 72 6e 20 | 5f 5f 7a 31 2e 52 65 20 | return |__z1.Re |
|00003ef0| 3d 3d 20 5f 5f 7a 32 52 | 65 20 26 26 20 5f 5f 7a |== __z2R|e && __z|
|00003f00| 31 2e 49 6d 20 3d 3d 20 | 30 2e 30 3b 20 7d 0d 0a |1.Im == |0.0; }..|
|00003f10| 0d 0a 69 6e 6c 69 6e 65 | 20 56 42 4f 4f 4c 20 5f |..inline| VBOOL _|
|00003f20| 5f 63 6d 6f 20 6f 70 65 | 72 61 74 6f 72 21 3d 28 |_cmo ope|rator!=(|
|00003f30| 63 6f 6d 70 6c 65 78 20 | 5f 56 46 41 52 43 20 26 |complex |_VFARC &|
|00003f40| 20 5f 5f 7a 31 2c 20 63 | 6f 6d 70 6c 65 78 20 5f | __z1, c|omplex _|
|00003f50| 56 46 41 52 43 20 26 20 | 5f 5f 7a 32 29 0d 0a 7b |VFARC & |__z2)..{|
|00003f60| 20 20 20 72 65 74 75 72 | 6e 20 5f 5f 7a 31 2e 52 | retur|n __z1.R|
|00003f70| 65 20 21 3d 20 5f 5f 7a | 32 2e 52 65 20 7c 7c 20 |e != __z|2.Re || |
|00003f80| 5f 5f 7a 31 2e 49 6d 20 | 21 3d 20 5f 5f 7a 32 2e |__z1.Im |!= __z2.|
|00003f90| 49 6d 3b 20 7d 0d 0a 0d | 0a 69 6e 6c 69 6e 65 20 |Im; }...|.inline |
|00003fa0| 56 42 4f 4f 4c 20 5f 5f | 63 6d 6f 20 6f 70 65 72 |VBOOL __|cmo oper|
|00003fb0| 61 74 6f 72 21 3d 28 63 | 6f 6d 70 6c 65 78 20 5f |ator!=(c|omplex _|
|00003fc0| 56 46 41 52 43 20 26 20 | 5f 5f 7a 31 2c 20 64 6f |VFARC & |__z1, do|
|00003fd0| 75 62 6c 65 20 5f 5f 7a | 32 52 65 29 0d 0a 7b 20 |uble __z|2Re)..{ |
|00003fe0| 20 20 72 65 74 75 72 6e | 20 5f 5f 7a 31 2e 52 65 | return| __z1.Re|
|00003ff0| 20 21 3d 20 5f 5f 7a 32 | 52 65 20 7c 7c 20 5f 5f | != __z2|Re || __|
|00004000| 7a 31 2e 49 6d 20 21 3d | 20 30 2e 30 3b 20 7d 0d |z1.Im !=| 0.0; }.|
|00004010| 0a 0d 0a 0d 0a 23 69 66 | 20 21 64 65 66 69 6e 65 |.....#if| !define|
|00004020| 64 28 52 43 5f 49 4e 56 | 4f 4b 45 44 29 0d 0a 0d |d(RC_INV|OKED)...|
|00004030| 0a 23 69 66 20 64 65 66 | 69 6e 65 64 28 5f 5f 53 |.#if def|ined(__S|
|00004040| 54 44 43 5f 5f 29 0d 0a | 23 70 72 61 67 6d 61 20 |TDC__)..|#pragma |
|00004050| 77 61 72 6e 20 2e 6e 61 | 6b 0d 0a 23 65 6e 64 69 |warn .na|k..#endi|
|00004060| 66 0d 0a 0d 0a 23 70 72 | 61 67 6d 61 20 6f 70 74 |f....#pr|agma opt|
|00004070| 69 6f 6e 20 2d 56 6f 2e | 0d 0a 0d 0a 23 69 66 20 |ion -Vo.|....#if |
|00004080| 64 65 66 69 6e 65 64 28 | 5f 5f 42 43 4f 50 54 5f |defined(|__BCOPT_|
|00004090| 5f 29 0d 0a 23 69 66 20 | 21 64 65 66 69 6e 65 64 |_)..#if |!defined|
|000040a0| 28 5f 5f 46 4c 41 54 5f | 5f 29 20 26 26 20 28 28 |(__FLAT_|_) && ((|
|000040b0| 5f 5f 42 4f 52 4c 41 4e | 44 43 5f 5f 20 3c 20 30 |__BORLAN|DC__ < 0|
|000040c0| 78 34 35 30 29 20 7c 7c | 20 21 64 65 66 69 6e 65 |x450) ||| !define|
|000040d0| 64 28 5f 52 54 4c 5f 41 | 4c 4c 4f 57 5f 70 6f 29 |d(_RTL_A|LLOW_po)|
|000040e0| 29 0d 0a 23 70 72 61 67 | 6d 61 20 6f 70 74 69 6f |)..#prag|ma optio|
|000040f0| 6e 20 2d 70 6f 2e 20 20 | 20 20 20 2f 2f 20 72 65 |n -po. | // re|
|00004100| 73 74 6f 72 65 20 4f 62 | 6a 65 63 74 20 64 61 74 |store Ob|ject dat|
|00004110| 61 20 63 61 6c 6c 69 6e | 67 20 63 6f 6e 76 65 6e |a callin|g conven|
|00004120| 74 69 6f 6e 0d 0a 23 65 | 6e 64 69 66 0d 0a 23 65 |tion..#e|ndif..#e|
|00004130| 6e 64 69 66 0d 0a 0d 0a | 23 65 6e 64 69 66 20 20 |ndif....|#endif |
|00004140| 2f 2a 20 21 52 43 5f 49 | 4e 56 4f 4b 45 44 20 2a |/* !RC_I|NVOKED *|
|00004150| 2f 0d 0a 23 69 66 20 21 | 64 65 66 69 6e 65 64 28 |/..#if !|defined(|
|00004160| 20 5f 43 4d 41 54 48 5f | 44 45 46 53 20 29 0d 0a | _CMATH_|DEFS )..|
|00004170| 20 20 20 23 64 65 66 69 | 6e 65 20 5f 43 4d 41 54 | #defi|ne _CMAT|
|00004180| 48 5f 44 45 46 53 0d 0a | 20 20 20 74 79 70 65 64 |H_DEFS..| typed|
|00004190| 65 66 20 73 74 72 75 63 | 74 20 7b 66 6c 6f 61 74 |ef struc|t {float|
|000041a0| 20 20 52 65 2c 20 49 6d | 3b 7d 20 66 43 6f 6d 70 | Re, Im|;} fComp|
|000041b0| 6c 65 78 3b 0d 0a 20 20 | 20 74 79 70 65 64 65 66 |lex;.. | typedef|
|000041c0| 20 63 6f 6d 70 6c 65 78 | 20 20 64 43 6f 6d 70 6c | complex| dCompl|
|000041d0| 65 78 3b 0d 0a 20 20 20 | 23 69 66 64 65 66 20 5f |ex;.. |#ifdef _|
|000041e0| 5f 42 4f 52 4c 41 4e 44 | 43 5f 5f 0d 0a 20 20 20 |_BORLAND|C__.. |
|000041f0| 20 20 20 20 74 79 70 65 | 64 65 66 20 6c 6f 6e 67 | type|def long|
|00004200| 20 64 6f 75 62 6c 65 20 | 20 65 78 74 65 6e 64 65 | double | extende|
|00004210| 64 3b 0d 0a 20 20 20 20 | 20 20 20 74 79 70 65 64 |d;.. | typed|
|00004220| 65 66 20 73 74 72 75 63 | 74 20 7b 65 78 74 65 6e |ef struc|t {exten|
|00004230| 64 65 64 20 52 65 2c 20 | 49 6d 3b 7d 20 65 43 6f |ded Re, |Im;} eCo|
|00004240| 6d 70 6c 65 78 3b 0d 0a | 20 20 20 23 65 6c 73 65 |mplex;..| #else|
|00004250| 20 2f 2a 20 57 61 74 63 | 6f 6d 2c 20 56 69 73 75 | /* Watc|om, Visu|
|00004260| 61 6c 20 43 2b 2b 20 2a | 2f 0d 0a 20 20 20 20 20 |al C++ *|/.. |
|00004270| 20 20 74 79 70 65 64 65 | 66 20 20 64 6f 75 62 6c | typede|f doubl|
|00004280| 65 20 65 78 74 65 6e 64 | 65 64 3b 20 2f 2a 20 56 |e extend|ed; /* V|
|00004290| 69 73 75 61 6c 20 43 2b | 2b 20 61 6e 64 20 4f 70 |isual C+|+ and Op|
|000042a0| 74 69 6d 61 2b 2b 20 64 | 6f 20 0d 0a 20 20 20 20 |tima++ d|o .. |
|000042b0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|000042c0| 20 20 20 20 20 20 20 20 | 6e 6f 74 20 73 75 70 70 | |not supp|
|000042d0| 6f 72 74 20 38 30 2d 62 | 69 74 20 49 45 45 45 20 |ort 80-b|it IEEE |
|000042e0| 6e 75 6d 62 65 72 73 2e | 20 53 6f 20 0d 0a 20 20 |numbers.| So .. |
|000042f0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004300| 20 20 20 20 20 20 20 20 | 20 20 6d 61 6b 65 20 65 | | make e|
|00004310| 78 74 65 6e 64 65 64 20 | 65 71 75 61 6c 20 74 6f |xtended |equal to|
|00004320| 20 64 6f 75 62 6c 65 20 | 20 20 20 2a 2f 0d 0a 20 | double | */.. |
|00004330| 20 20 20 20 20 20 74 79 | 70 65 64 65 66 20 64 43 | ty|pedef dC|
|00004340| 6f 6d 70 6c 65 78 20 20 | 65 43 6f 6d 70 6c 65 78 |omplex |eComplex|
|00004350| 3b 0d 0a 20 20 20 23 65 | 6e 64 69 66 20 20 20 20 |;.. #e|ndif |
|00004360| 2f 2a 20 72 65 73 74 6f | 72 65 20 64 65 66 61 75 |/* resto|re defau|
|00004370| 6c 74 20 64 61 74 61 20 | 70 61 63 6b 69 6e 67 20 |lt data |packing |
|00004380| 20 2a 2f 0d 0a 23 65 6e | 64 69 66 0d 0a 0d 0a 23 | */..#en|dif....#|
|00004390| 65 6c 73 65 20 20 20 2f | 2f 20 64 65 63 6c 61 72 |else /|/ declar|
|000043a0| 65 20 74 68 65 20 63 6f | 6d 70 6c 65 78 20 63 6c |e the co|mplex cl|
|000043b0| 61 73 73 65 73 20 66 6f | 72 20 61 6c 6c 20 74 68 |asses fo|r all th|
|000043c0| 72 65 65 20 6c 65 76 65 | 6c 73 20 6f 66 20 70 72 |ree leve|ls of pr|
|000043d0| 65 63 69 73 69 6f 6e 0d | 0a 20 20 20 20 20 20 20 |ecision.|. |
|000043e0| 20 2f 2f 20 41 6c 74 68 | 6f 75 67 68 20 74 68 65 | // Alth|ough the|
|000043f0| 73 65 20 63 6c 61 73 73 | 65 73 20 61 72 65 20 66 |se class|es are f|
|00004400| 75 6c 6c 79 20 63 6f 6d | 70 61 74 69 62 6c 65 20 |ully com|patible |
|00004410| 74 6f 20 74 68 65 20 63 | 6f 6d 70 6c 65 78 0d 0a |to the c|omplex..|
|00004420| 20 20 20 20 20 20 20 20 | 2f 2f 20 63 6c 61 73 73 | |// class|
|00004430| 65 73 20 6f 66 20 74 68 | 65 20 53 74 61 6e 64 61 |es of th|e Standa|
|00004440| 72 64 20 43 2b 2b 20 4c | 69 62 72 61 72 79 2c 20 |rd C++ L|ibrary, |
|00004450| 6b 65 65 70 20 74 68 65 | 6d 20 6f 75 74 20 6f 66 |keep the|m out of|
|00004460| 20 74 68 65 0d 0a 20 20 | 20 20 20 20 20 20 2f 2f | the.. | //|
|00004470| 20 73 74 61 6e 64 61 72 | 64 20 6e 61 6d 65 73 70 | standar|d namesp|
|00004480| 61 63 65 2e 0d 0a 0d 0a | 74 65 6d 70 6c 61 74 65 |ace.....|template|
|00004490| 20 3c 63 6c 61 73 73 20 | 54 3e 0d 0a 63 6c 61 73 | <class |T>..clas|
|000044a0| 73 20 63 6f 6d 70 6c 65 | 78 3b 0d 0a 63 6c 61 73 |s comple|x;..clas|
|000044b0| 73 20 63 6f 6d 70 6c 65 | 78 3c 66 6c 6f 61 74 3e |s comple|x<float>|
|000044c0| 3b 0d 0a 63 6c 61 73 73 | 20 63 6f 6d 70 6c 65 78 |;..class| complex|
|000044d0| 3c 64 6f 75 62 6c 65 3e | 3b 0d 0a 63 6c 61 73 73 |<double>|;..class|
|000044e0| 20 63 6f 6d 70 6c 65 78 | 3c 6c 6f 6e 67 20 64 6f | complex|<long do|
|000044f0| 75 62 6c 65 3e 3b 0d 0a | 0d 0a 63 6c 61 73 73 20 |uble>;..|..class |
|00004500| 63 6f 6d 70 6c 65 78 3c | 66 6c 6f 61 74 3e 0d 0a |complex<|float>..|
|00004510| 7b 0d 0a 20 20 70 75 62 | 6c 69 63 3a 0d 0a 20 20 |{.. pub|lic:.. |
|00004520| 20 20 20 20 20 20 20 2f | 2f 20 63 6f 6e 73 74 72 | /|/ constr|
|00004530| 75 63 74 6f 72 73 3a 0d | 0a 20 20 20 20 23 69 66 |uctors:.|. #if|
|00004540| 20 64 65 66 69 6e 65 64 | 20 5f 5f 42 4f 52 4c 41 | defined| __BORLA|
|00004550| 4e 44 43 5f 5f 20 26 26 | 20 5f 5f 42 4f 52 4c 41 |NDC__ &&| __BORLA|
|00004560| 4e 44 43 5f 5f 20 3e 3d | 20 30 78 34 35 30 0d 0a |NDC__ >=| 0x450..|
|00004570| 20 20 20 20 20 20 20 20 | 63 6f 6d 70 6c 65 78 28 | |complex(|
|00004580| 20 66 6c 6f 61 74 20 52 | 65 5f 70 61 72 74 2c 20 | float R|e_part, |
|00004590| 66 6c 6f 61 74 20 49 6d | 5f 70 61 72 74 20 29 20 |float Im|_part ) |
|000045a0| 7b 52 65 3d 52 65 5f 70 | 61 72 74 3b 20 49 6d 3d |{Re=Re_p|art; Im=|
|000045b0| 49 6d 5f 70 61 72 74 3b | 7d 0d 0a 20 20 20 20 20 |Im_part;|}.. |
|000045c0| 20 20 20 63 6f 6d 70 6c | 65 78 28 20 66 6c 6f 61 | compl|ex( floa|
|000045d0| 74 20 52 65 5f 70 61 72 | 74 20 29 20 20 7b 52 65 |t Re_par|t ) {Re|
|000045e0| 3d 52 65 5f 70 61 72 74 | 3b 20 49 6d 3d 30 3b 7d |=Re_part|; Im=0;}|
|000045f0| 0d 0a 20 20 20 20 20 20 | 20 20 63 6f 6d 70 6c 65 |.. | comple|
|00004600| 78 28 29 20 7b 7d 3b 20 | 2f 2f 20 6d 6f 73 74 20 |x() {}; |// most |
|00004610| 65 66 66 69 63 69 65 6e | 74 20 74 6f 20 68 61 76 |efficien|t to hav|
|00004620| 65 20 74 68 65 73 65 20 | 61 73 20 74 68 72 65 65 |e these |as three|
|00004630| 20 64 69 66 66 65 72 65 | 6e 74 20 63 6f 6e 73 74 | differe|nt const|
|00004640| 72 75 63 74 6f 72 73 21 | 0d 0a 20 20 20 20 20 20 |ructors!|.. |
|00004650| 20 20 20 20 20 20 2f 2f | 20 69 6e 74 65 72 63 6f | //| interco|
|00004660| 6e 76 65 72 73 69 6f 6e | 73 20 62 65 74 77 65 65 |nversion|s betwee|
|00004670| 6e 20 74 68 65 20 74 68 | 72 65 65 20 6c 65 76 65 |n the th|ree leve|
|00004680| 6c 73 20 6f 66 20 61 63 | 63 75 72 61 63 79 3a 0d |ls of ac|curacy:.|
|00004690| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 |. | // |
|000046a0| 77 69 74 68 20 4f 56 45 | 52 46 4c 4f 57 20 65 72 |with OVE|RFLOW er|
|000046b0| 72 6f 72 20 68 61 6e 64 | 6c 69 6e 67 20 66 6f 72 |ror hand|ling for|
|000046c0| 20 74 68 65 20 64 6f 77 | 6e 2d 63 6f 6e 76 65 72 | the dow|n-conver|
|000046d0| 73 69 6f 6e 73 0d 0a 20 | 20 20 20 23 65 6c 73 65 |sions.. | #else|
|000046e0| 20 2f 2f 20 70 72 6f 62 | 6c 65 6d 73 20 77 69 74 | // prob|lems wit|
|000046f0| 68 20 74 68 65 20 74 65 | 6d 70 6c 61 74 65 20 64 |h the te|mplate d|
|00004700| 65 66 69 6e 69 74 69 6f | 6e 73 20 69 6e 20 6f 6c |efinitio|ns in ol|
|00004710| 64 65 72 20 76 65 72 73 | 69 6f 6e 73 0d 0a 20 20 |der vers|ions.. |
|00004720| 20 20 20 20 20 20 63 6f | 6d 70 6c 65 78 3c 66 6c | co|mplex<fl|
|00004730| 6f 61 74 3e 28 20 66 6c | 6f 61 74 20 52 65 5f 70 |oat>( fl|oat Re_p|
|00004740| 61 72 74 2c 20 66 6c 6f | 61 74 20 49 6d 5f 70 61 |art, flo|at Im_pa|
|00004750| 72 74 20 29 20 7b 52 65 | 3d 52 65 5f 70 61 72 74 |rt ) {Re|=Re_part|
|00004760| 3b 20 49 6d 3d 49 6d 5f | 70 61 72 74 3b 7d 0d 0a |; Im=Im_|part;}..|
|00004770| 20 20 20 20 20 20 20 20 | 63 6f 6d 70 6c 65 78 3c | |complex<|
|00004780| 66 6c 6f 61 74 3e 28 20 | 66 6c 6f 61 74 20 52 65 |float>( |float Re|
|00004790| 5f 70 61 72 74 20 29 20 | 20 7b 52 65 3d 52 65 5f |_part ) | {Re=Re_|
|000047a0| 70 61 72 74 3b 20 49 6d | 3d 30 3b 7d 0d 0a 20 20 |part; Im|=0;}.. |
|000047b0| 20 20 20 20 20 20 63 6f | 6d 70 6c 65 78 3c 66 6c | co|mplex<fl|
|000047c0| 6f 61 74 3e 28 29 20 7b | 7d 3b 20 2f 2f 20 6d 6f |oat>() {|}; // mo|
|000047d0| 73 74 20 65 66 66 69 63 | 69 65 6e 74 20 74 6f 20 |st effic|ient to |
|000047e0| 68 61 76 65 20 74 68 65 | 73 65 20 61 73 20 74 68 |have the|se as th|
|000047f0| 72 65 65 20 64 69 66 66 | 65 72 65 6e 74 20 63 6f |ree diff|erent co|
|00004800| 6e 73 74 72 75 63 74 6f | 72 73 21 0d 0a 20 20 20 |nstructo|rs!.. |
|00004810| 20 23 65 6e 64 69 66 0d | 0a 20 20 20 20 23 69 66 | #endif.|. #if|
|00004820| 20 21 64 65 66 69 6e 65 | 64 20 5f 5f 42 4f 52 4c | !define|d __BORL|
|00004830| 41 4e 44 43 5f 5f 20 7c | 7c 20 5f 5f 42 4f 52 4c |ANDC__ ||| __BORL|
|00004840| 41 4e 44 43 5f 5f 20 3e | 20 30 78 35 30 30 0d 0a |ANDC__ >| 0x500..|
|00004850| 20 20 20 20 20 20 20 20 | 63 6f 6d 70 6c 65 78 3c | |complex<|
|00004860| 66 6c 6f 61 74 3e 20 28 | 63 6f 6d 70 6c 65 78 3c |float> (|complex<|
|00004870| 66 6c 6f 61 74 3e 20 5f | 56 46 41 52 43 20 26 29 |float> _|VFARC &)|
|00004880| 3b 0d 0a 20 20 20 20 23 | 65 6e 64 69 66 0d 0a 20 |;.. #|endif.. |
|00004890| 20 20 20 23 69 66 20 64 | 65 66 69 6e 65 64 20 5f | #if d|efined _|
|000048a0| 5f 42 4f 52 4c 41 4e 44 | 43 5f 5f 20 26 26 20 5f |_BORLAND|C__ && _|
|000048b0| 5f 42 4f 52 4c 41 4e 44 | 43 5f 5f 20 3e 3d 20 30 |_BORLAND|C__ >= 0|
|000048c0| 78 35 30 30 0d 0a 20 20 | 20 20 20 20 20 20 65 78 |x500.. | ex|
|000048d0| 70 6c 69 63 69 74 20 63 | 6f 6d 70 6c 65 78 20 28 |plicit c|omplex (|
|000048e0| 63 6f 6d 70 6c 65 78 3c | 64 6f 75 62 6c 65 3e 20 |complex<|double> |
|000048f0| 5f 56 46 41 52 43 20 26 | 29 3b 0d 0a 20 20 20 20 |_VFARC &|);.. |
|00004900| 20 20 20 20 65 78 70 6c | 69 63 69 74 20 63 6f 6d | expl|icit com|
|00004910| 70 6c 65 78 20 28 63 6f | 6d 70 6c 65 78 3c 6c 6f |plex (co|mplex<lo|
|00004920| 6e 67 20 64 6f 75 62 6c | 65 3e 20 5f 56 46 41 52 |ng doubl|e> _VFAR|
|00004930| 43 20 26 29 3b 0d 0a 20 | 20 20 20 23 65 6c 73 65 |C &);.. | #else|
|00004940| 0d 0a 20 20 20 20 20 20 | 20 20 63 6f 6d 70 6c 65 |.. | comple|
|00004950| 78 3c 66 6c 6f 61 74 3e | 20 28 63 6f 6d 70 6c 65 |x<float>| (comple|
|00004960| 78 3c 64 6f 75 62 6c 65 | 3e 20 5f 56 46 41 52 43 |x<double|> _VFARC|
|00004970| 20 26 29 3b 0d 0a 20 20 | 20 20 20 20 20 20 63 6f | &);.. | co|
|00004980| 6d 70 6c 65 78 3c 66 6c | 6f 61 74 3e 20 28 63 6f |mplex<fl|oat> (co|
|00004990| 6d 70 6c 65 78 3c 6c 6f | 6e 67 20 64 6f 75 62 6c |mplex<lo|ng doubl|
|000049a0| 65 3e 20 5f 56 46 41 52 | 43 20 26 29 3b 0d 0a 20 |e> _VFAR|C &);.. |
|000049b0| 20 20 20 23 65 6e 64 69 | 66 0d 0a 20 20 20 20 66 | #endi|f.. f|
|000049c0| 72 69 65 6e 64 20 63 6f | 6d 70 6c 65 78 3c 66 6c |riend co|mplex<fl|
|000049d0| 6f 61 74 3e 20 5f 5f 63 | 6d 66 20 63 64 74 6f 63 |oat> __c|mf cdtoc|
|000049e0| 66 28 20 63 6f 6d 70 6c | 65 78 3c 64 6f 75 62 6c |f( compl|ex<doubl|
|000049f0| 65 3e 20 63 64 20 29 3b | 0d 0a 20 20 20 20 66 72 |e> cd );|.. fr|
|00004a00| 69 65 6e 64 20 63 6f 6d | 70 6c 65 78 3c 66 6c 6f |iend com|plex<flo|
|00004a10| 61 74 3e 20 5f 5f 63 6d | 66 20 63 65 74 6f 63 66 |at> __cm|f cetocf|
|00004a20| 28 20 63 6f 6d 70 6c 65 | 78 3c 6c 6f 6e 67 20 64 |( comple|x<long d|
|00004a30| 6f 75 62 6c 65 3e 20 63 | 65 20 29 3b 0d 0a 20 20 |ouble> c|e );.. |
|00004a40| 20 20 20 20 20 2f 2f 20 | 73 69 6d 70 6c 65 20 61 | // |simple a|
|00004a50| 73 73 69 67 6e 6d 65 6e | 74 73 3a 20 6e 6f 20 4f |ssignmen|ts: no O|
|00004a60| 56 45 52 46 4c 4f 57 20 | 65 72 72 6f 72 20 68 61 |VERFLOW |error ha|
|00004a70| 6e 64 6c 69 6e 67 0d 0a | 20 20 20 20 23 69 66 20 |ndling..| #if |
|00004a80| 21 64 65 66 69 6e 65 64 | 20 5f 5f 42 4f 52 4c 41 |!defined| __BORLA|
|00004a90| 4e 44 43 5f 5f 20 7c 7c | 20 5f 5f 42 4f 52 4c 41 |NDC__ ||| __BORLA|
|00004aa0| 4e 44 43 5f 5f 20 3e 20 | 30 78 35 30 30 0d 0a 20 |NDC__ > |0x500.. |
|00004ab0| 20 20 20 20 20 20 20 63 | 6f 6d 70 6c 65 78 3c 66 | c|omplex<f|
|00004ac0| 6c 6f 61 74 3e 20 5f 56 | 46 41 52 20 26 20 5f 5f |loat> _V|FAR & __|
|00004ad0| 63 6d 6f 20 20 6f 70 65 | 72 61 74 6f 72 3d 20 28 |cmo ope|rator= (|
|00004ae0| 63 6f 6d 70 6c 65 78 3c | 66 6c 6f 61 74 3e 20 5f |complex<|float> _|
|00004af0| 56 46 41 52 43 20 26 29 | 3b 0d 0a 20 20 20 20 23 |VFARC &)|;.. #|
|00004b00| 65 6e 64 69 66 0d 0a 20 | 20 20 20 63 6f 6d 70 6c |endif.. | compl|
|00004b10| 65 78 3c 66 6c 6f 61 74 | 3e 20 5f 56 46 41 52 20 |ex<float|> _VFAR |
|00004b20| 26 20 5f 5f 63 6d 6f 20 | 20 6f 70 65 72 61 74 6f |& __cmo | operato|
|00004b30| 72 3d 20 28 63 6f 6d 70 | 6c 65 78 3c 64 6f 75 62 |r= (comp|lex<doub|
|00004b40| 6c 65 3e 20 5f 56 46 41 | 52 43 20 26 29 3b 0d 0a |le> _VFA|RC &);..|
|00004b50| 20 20 20 20 63 6f 6d 70 | 6c 65 78 3c 66 6c 6f 61 | comp|lex<floa|
|00004b60| 74 3e 20 5f 56 46 41 52 | 20 26 20 5f 5f 63 6d 6f |t> _VFAR| & __cmo|
|00004b70| 20 20 6f 70 65 72 61 74 | 6f 72 3d 20 28 63 6f 6d | operat|or= (com|
|00004b80| 70 6c 65 78 3c 6c 6f 6e | 67 20 64 6f 75 62 6c 65 |plex<lon|g double|
|00004b90| 3e 20 5f 56 46 41 52 43 | 20 26 29 3b 0d 0a 0d 0a |> _VFARC| &);....|
|00004ba0| 20 20 20 20 2f 2f 20 43 | 61 72 74 65 73 69 61 6e | // C|artesian|
|00004bb0| 20 63 6f 6d 70 6c 65 78 | 20 66 72 6f 6d 20 70 6f | complex| from po|
|00004bc0| 6c 61 72 20 63 6f 6f 72 | 64 69 6e 61 74 65 73 3a |lar coor|dinates:|
|00004bd0| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|00004be0| 70 6c 65 78 3c 66 6c 6f | 61 74 3e 20 5f 5f 63 6d |plex<flo|at> __cm|
|00004bf0| 66 20 70 6f 6c 61 72 28 | 66 6c 6f 61 74 20 5f 6d |f polar(|float _m|
|00004c00| 61 67 2c 20 66 6c 6f 61 | 74 20 5f 61 6e 67 6c 65 |ag, floa|t _angle|
|00004c10| 3d 30 29 3b 0d 0a 0d 0a | 20 20 20 20 2f 2f 20 62 |=0);....| // b|
|00004c20| 61 73 69 63 20 6f 70 65 | 72 61 74 69 6f 6e 73 3a |asic ope|rations:|
|00004c30| 0d 0a 20 20 20 20 66 6c | 6f 61 74 20 72 65 61 6c |.. fl|oat real|
|00004c40| 28 29 20 7b 20 72 65 74 | 75 72 6e 20 52 65 3b 20 |() { ret|urn Re; |
|00004c50| 7d 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 |} | |
|00004c60| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 2f | | /|
|00004c70| 2f 20 72 65 61 6c 20 70 | 61 72 74 0d 0a 20 20 20 |/ real p|art.. |
|00004c80| 20 66 72 69 65 6e 64 20 | 66 6c 6f 61 74 20 5f 5f | friend |float __|
|00004c90| 63 6d 66 20 72 65 61 6c | 28 63 6f 6d 70 6c 65 78 |cmf real|(complex|
|00004ca0| 3c 66 6c 6f 61 74 3e 20 | 5f 56 46 41 52 43 20 26 |<float> |_VFARC &|
|00004cb0| 5f 7a 29 3b 0d 0a 20 20 | 20 20 66 6c 6f 61 74 20 |_z);.. | float |
|00004cc0| 69 6d 61 67 28 29 20 7b | 20 72 65 74 75 72 6e 20 |imag() {| return |
|00004cd0| 49 6d 3b 20 7d 20 20 20 | 20 20 20 20 20 20 20 20 |Im; } | |
|00004ce0| 20 20 20 20 20 20 20 20 | 20 20 20 20 20 20 20 20 | | |
|00004cf0| 20 20 20 2f 2f 20 69 6d | 61 67 69 6e 61 72 79 20 | // im|aginary |
|00004d00| 70 61 72 74 0d 0a 20 20 | 20 20 66 72 69 65 6e 64 |part.. | friend|
|00004d10| 20 66 6c 6f 61 74 20 5f | 5f 63 6d 66 20 69 6d 61 | float _|_cmf ima|
|00004d20| 67 28 63 6f 6d 70 6c 65 | 78 3c 66 6c 6f 61 74 3e |g(comple|x<float>|
|00004d30| 20 5f 56 46 41 52 43 20 | 26 5f 7a 29 3b 0d 0a 20 | _VFARC |&_z);.. |
|00004d40| 20 20 20 66 72 69 65 6e | 64 20 63 6f 6d 70 6c 65 | frien|d comple|
|00004d50| 78 3c 66 6c 6f 61 74 3e | 20 5f 5f 63 6d 66 20 6e |x<float>| __cmf n|
|00004d60| 65 67 28 63 6f 6d 70 6c | 65 78 3c 66 6c 6f 61 74 |eg(compl|ex<float|
|00004d70| 3e 20 5f 56 46 41 52 43 | 20 26 29 3b 20 2f 2f 20 |> _VFARC| &); // |
|00004d80| 73 61 6d 65 20 61 73 20 | 75 6e 61 72 79 20 6f 70 |same as |unary op|
|00004d90| 65 72 61 74 6f 72 20 2d | 0d 0a 20 20 20 20 66 72 |erator -|.. fr|
|00004da0| 69 65 6e 64 20 63 6f 6d | 70 6c 65 78 3c 66 6c 6f |iend com|plex<flo|
|00004db0| 61 74 3e 20 5f 5f 63 6d | 66 20 63 6f 6e 6a 28 63 |at> __cm|f conj(c|
|00004dc0| 6f 6d 70 6c 65 78 3c 66 | 6c 6f 61 74 3e 20 5f 56 |omplex<f|loat> _V|
|00004dd0| 46 41 52 43 20 26 29 3b | 2f 2f 20 63 6f 6d 70 6c |FARC &);|// compl|
|00004de0| 65 78 20 63 6f 6e 6a 75 | 67 61 74 65 0d 0a 20 20 |ex conju|gate.. |
|00004df0| 20 20 66 72 69 65 6e 64 | 20 66 6c 6f 61 74 20 20 | friend| float |
|00004e00| 5f 5f 63 6d 66 20 6e 6f | 72 6d 28 63 6f 6d 70 6c |__cmf no|rm(compl|
|00004e10| 65 78 3c 66 6c 6f 61 74 | 3e 20 5f 56 46 41 52 43 |ex<float|> _VFARC|
|00004e20| 20 26 29 3b 20 20 2f 2f | 20 73 71 75 61 72 65 20 | &); //| square |
|00004e30| 6f 66 20 74 68 65 20 6d | 61 67 6e 69 74 75 64 65 |of the m|agnitude|
|00004e40| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 66 6c 6f |.. fr|iend flo|
|00004e50| 61 74 20 20 5f 5f 63 6d | 66 20 61 72 67 28 63 6f |at __cm|f arg(co|
|00004e60| 6d 70 6c 65 78 3c 66 6c | 6f 61 74 3e 29 3b 20 20 |mplex<fl|oat>); |
|00004e70| 20 20 20 20 20 20 20 20 | 20 2f 2f 20 61 6e 67 6c | | // angl|
|00004e80| 65 20 69 6e 20 74 68 65 | 20 70 6c 61 6e 65 0d 0a |e in the| plane..|
|00004e90| 0d 0a 20 20 20 20 20 2f | 2f 20 55 6e 61 72 79 20 |.. /|/ Unary |
|00004ea0| 6f 70 65 72 61 74 6f 72 | 73 0d 0a 20 20 20 20 63 |operator|s.. c|
|00004eb0| 6f 6d 70 6c 65 78 3c 66 | 6c 6f 61 74 3e 20 5f 56 |omplex<f|loat> _V|
|00004ec0| 46 41 52 20 26 20 5f 5f | 63 6d 6f 20 6f 70 65 72 |FAR & __|cmo oper|
|00004ed0| 61 74 6f 72 2b 28 29 3b | 0d 0a 20 20 20 20 66 72 |ator+();|.. fr|
|00004ee0| 69 65 6e 64 20 63 6f 6d | 70 6c 65 78 3c 66 6c 6f |iend com|plex<flo|
|00004ef0| 61 74 3e 20 5f 5f 63 6d | 66 20 6f 70 65 72 61 74 |at> __cm|f operat|
|00004f00| 6f 72 2d 28 20 63 6f 6d | 70 6c 65 78 3c 66 6c 6f |or-( com|plex<flo|
|00004f10| 61 74 3e 20 5f 56 46 41 | 52 43 20 26 29 3b 0d 0a |at> _VFA|RC &);..|
|00004f20| 0d 0a 20 20 20 20 2f 2f | 20 42 69 6e 61 72 79 20 |.. //| Binary |
|00004f30| 6f 70 65 72 61 74 6f 72 | 73 3a 0d 0a 20 20 20 20 |operator|s:.. |
|00004f40| 66 72 69 65 6e 64 20 63 | 6f 6d 70 6c 65 78 3c 66 |friend c|omplex<f|
|00004f50| 6c 6f 61 74 3e 20 5f 5f | 63 6d 66 20 6f 70 65 72 |loat> __|cmf oper|
|00004f60| 61 74 6f 72 2b 28 63 6f | 6d 70 6c 65 78 3c 66 6c |ator+(co|mplex<fl|
|00004f70| 6f 61 74 3e 20 5f 56 46 | 41 52 43 20 26 2c 20 63 |oat> _VF|ARC &, c|
|00004f80| 6f 6d 70 6c 65 78 3c 66 | 6c 6f 61 74 3e 20 5f 56 |omplex<f|loat> _V|
|00004f90| 46 41 52 43 20 26 29 3b | 0d 0a 20 20 20 20 66 72 |FARC &);|.. fr|
|00004fa0| 69 65 6e 64 20 63 6f 6d | 70 6c 65 78 3c 66 6c 6f |iend com|plex<flo|
|00004fb0| 61 74 3e 20 5f 5f 63 6d | 66 20 6f 70 65 72 61 74 |at> __cm|f operat|
|00004fc0| 6f 72 2b 28 66 6c 6f 61 | 74 2c 20 63 6f 6d 70 6c |or+(floa|t, compl|
|00004fd0| 65 78 3c 66 6c 6f 61 74 | 3e 20 5f 56 46 41 52 43 |ex<float|> _VFARC|
|00004fe0| 20 26 29 3b 0d 0a 20 20 | 20 20 66 72 69 65 6e 64 | &);.. | friend|
|00004ff0| 20 63 6f 6d 70 6c 65 78 | 3c 66 6c 6f 61 74 3e 20 | complex|<float> |
|00005000| 5f 5f 63 6d 66 20 6f 70 | 65 72 61 74 6f 72 2b 28 |__cmf op|erator+(|
|00005010| 63 6f 6d 70 6c 65 78 3c | 66 6c 6f 61 74 3e 20 5f |complex<|float> _|
|00005020| 56 46 41 52 43 20 26 2c | 20 66 6c 6f 61 74 29 3b |VFARC &,| float);|
|00005030| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|00005040| 70 6c 65 78 3c 66 6c 6f | 61 74 3e 20 5f 5f 63 6d |plex<flo|at> __cm|
|00005050| 66 20 6f 70 65 72 61 74 | 6f 72 2d 28 63 6f 6d 70 |f operat|or-(comp|
|00005060| 6c 65 78 3c 66 6c 6f 61 | 74 3e 20 5f 56 46 41 52 |lex<floa|t> _VFAR|
|00005070| 43 20 26 2c 20 63 6f 6d | 70 6c 65 78 3c 66 6c 6f |C &, com|plex<flo|
|00005080| 61 74 3e 20 5f 56 46 41 | 52 43 20 26 29 3b 0d 0a |at> _VFA|RC &);..|
|00005090| 20 20 20 20 66 72 69 65 | 6e 64 20 63 6f 6d 70 6c | frie|nd compl|
|000050a0| 65 78 3c 66 6c 6f 61 74 | 3e 20 5f 5f 63 6d 66 20 |ex<float|> __cmf |
|000050b0| 6f 70 65 72 61 74 6f 72 | 2d 28 66 6c 6f 61 74 2c |operator|-(float,|
|000050c0| 20 63 6f 6d 70 6c 65 78 | 3c 66 6c 6f 61 74 3e 20 | complex|<float> |
|000050d0| 5f 56 46 41 52 43 20 26 | 29 3b 0d 0a 20 20 20 20 |_VFARC &|);.. |
|000050e0| 66 72 69 65 6e 64 20 63 | 6f 6d 70 6c 65 78 3c 66 |friend c|omplex<f|
|000050f0| 6c 6f 61 74 3e 20 5f 5f | 63 6d 66 20 6f 70 65 72 |loat> __|cmf oper|
|00005100| 61 74 6f 72 2d 28 63 6f | 6d 70 6c 65 78 3c 66 6c |ator-(co|mplex<fl|
|00005110| 6f 61 74 3e 20 5f 56 46 | 41 52 43 20 26 2c 20 66 |oat> _VF|ARC &, f|
|00005120| 6c 6f 61 74 29 3b 0d 0a | 20 20 20 20 66 72 69 65 |loat);..| frie|
|00005130| 6e 64 20 63 6f 6d 70 6c | 65 78 3c 66 6c 6f 61 74 |nd compl|ex<float|
|00005140| 3e 20 5f 5f 63 6d 66 20 | 6f 70 65 72 61 74 6f 72 |> __cmf |operator|
|00005150| 2a 28 63 6f 6d 70 6c 65 | 78 3c 66 6c 6f 61 74 3e |*(comple|x<float>|
|00005160| 20 5f 56 46 41 52 43 20 | 26 2c 20 63 6f 6d 70 6c | _VFARC |&, compl|
|00005170| 65 78 3c 66 6c 6f 61 74 | 3e 20 5f 56 46 41 52 43 |ex<float|> _VFARC|
|00005180| 20 26 29 3b 0d 0a 20 20 | 20 20 66 72 69 65 6e 64 | &);.. | friend|
|00005190| 20 63 6f 6d 70 6c 65 78 | 3c 66 6c 6f 61 74 3e 20 | complex|<float> |
|000051a0| 5f 5f 63 6d 66 20 6f 70 | 65 72 61 74 6f 72 2a 28 |__cmf op|erator*(|
|000051b0| 63 6f 6d 70 6c 65 78 3c | 66 6c 6f 61 74 3e 20 5f |complex<|float> _|
|000051c0| 56 46 41 52 43 20 26 2c | 20 66 6c 6f 61 74 29 3b |VFARC &,| float);|
|000051d0| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|000051e0| 70 6c 65 78 3c 66 6c 6f | 61 74 3e 20 5f 5f 63 6d |plex<flo|at> __cm|
|000051f0| 66 20 6f 70 65 72 61 74 | 6f 72 2a 28 66 6c 6f 61 |f operat|or*(floa|
|00005200| 74 2c 20 63 6f 6d 70 6c | 65 78 3c 66 6c 6f 61 74 |t, compl|ex<float|
|00005210| 3e 20 5f 56 46 41 52 43 | 20 26 29 3b 0d 0a 20 20 |> _VFARC| &);.. |
|00005220| 20 20 66 72 69 65 6e 64 | 20 63 6f 6d 70 6c 65 78 | friend| complex|
|00005230| 3c 66 6c 6f 61 74 3e 20 | 5f 5f 63 6d 66 20 6f 70 |<float> |__cmf op|
|00005240| 65 72 61 74 6f 72 2f 28 | 63 6f 6d 70 6c 65 78 3c |erator/(|complex<|
|00005250| 66 6c 6f 61 74 3e 20 5f | 56 46 41 52 43 20 26 2c |float> _|VFARC &,|
|00005260| 20 63 6f 6d 70 6c 65 78 | 3c 66 6c 6f 61 74 3e 20 | complex|<float> |
|00005270| 5f 56 46 41 52 43 20 26 | 29 3b 0d 0a 20 20 20 20 |_VFARC &|);.. |
|00005280| 66 72 69 65 6e 64 20 63 | 6f 6d 70 6c 65 78 3c 66 |friend c|omplex<f|
|00005290| 6c 6f 61 74 3e 20 5f 5f | 63 6d 66 20 6f 70 65 72 |loat> __|cmf oper|
|000052a0| 61 74 6f 72 2f 28 63 6f | 6d 70 6c 65 78 3c 66 6c |ator/(co|mplex<fl|
|000052b0| 6f 61 74 3e 20 5f 56 46 | 41 52 43 20 26 2c 20 66 |oat> _VF|ARC &, f|
|000052c0| 6c 6f 61 74 29 3b 0d 0a | 20 20 20 20 66 72 69 65 |loat);..| frie|
|000052d0| 6e 64 20 63 6f 6d 70 6c | 65 78 3c 66 6c 6f 61 74 |nd compl|ex<float|
|000052e0| 3e 20 5f 5f 63 6d 66 20 | 6f 70 65 72 61 74 6f 72 |> __cmf |operator|
|000052f0| 2f 28 66 6c 6f 61 74 2c | 20 63 6f 6d 70 6c 65 78 |/(float,| complex|
|00005300| 3c 66 6c 6f 61 74 3e 20 | 5f 56 46 41 52 43 20 26 |<float> |_VFARC &|
|00005310| 29 3b 0d 0a 20 20 20 20 | 20 20 20 2f 2f 20 6d 69 |);.. | // mi|
|00005320| 78 65 64 2d 61 63 63 75 | 72 61 63 79 20 62 69 6e |xed-accu|racy bin|
|00005330| 61 72 79 20 6f 70 65 72 | 61 74 6f 72 73 20 61 72 |ary oper|ators ar|
|00005340| 65 20 64 65 63 6c 61 72 | 65 64 20 61 74 20 74 68 |e declar|ed at th|
|00005350| 65 20 68 69 67 68 65 72 | 2d 61 63 63 75 72 61 63 |e higher|-accurac|
|00005360| 79 20 63 6c 61 73 73 65 | 73 0d 0a 0d 0a 20 20 20 |y classe|s.... |
|00005370| 20 66 72 69 65 6e 64 20 | 56 42 4f 4f 4c 20 5f 5f | friend |VBOOL __|
|00005380| 63 6d 66 20 6f 70 65 72 | 61 74 6f 72 3d 3d 28 63 |cmf oper|ator==(c|
|00005390| 6f 6d 70 6c 65 78 3c 66 | 6c 6f 61 74 3e 20 5f 56 |omplex<f|loat> _V|
|000053a0| 46 41 52 43 20 26 2c 20 | 63 6f 6d 70 6c 65 78 3c |FARC &, |complex<|
|000053b0| 66 6c 6f 61 74 3e 20 5f | 56 46 41 52 43 20 26 29 |float> _|VFARC &)|
|000053c0| 3b 0d 0a 20 20 20 20 66 | 72 69 65 6e 64 20 56 42 |;.. f|riend VB|
|000053d0| 4f 4f 4c 20 5f 5f 63 6d | 66 20 6f 70 65 72 61 74 |OOL __cm|f operat|
|000053e0| 6f 72 3d 3d 28 63 6f 6d | 70 6c 65 78 3c 66 6c 6f |or==(com|plex<flo|
|000053f0| 61 74 3e 20 5f 56 46 41 | 52 43 20 26 2c 20 66 6c |at> _VFA|RC &, fl|
|00005400| 6f 61 74 29 3b 0d 0a 20 | 20 20 20 66 72 69 65 6e |oat);.. | frien|
|00005410| 64 20 56 42 4f 4f 4c 20 | 5f 5f 63 6d 66 20 6f 70 |d VBOOL |__cmf op|
|00005420| 65 72 61 74 6f 72 21 3d | 28 63 6f 6d 70 6c 65 78 |erator!=|(complex|
|00005430| 3c 66 6c 6f 61 74 3e 20 | 5f 56 46 41 52 43 20 26 |<float> |_VFARC &|
|00005440| 2c 20 63 6f 6d 70 6c 65 | 78 3c 66 6c 6f 61 74 3e |, comple|x<float>|
|00005450| 20 5f 56 46 41 52 43 20 | 26 29 3b 0d 0a 20 20 20 | _VFARC |&);.. |
|00005460| 20 66 72 69 65 6e 64 20 | 56 42 4f 4f 4c 20 5f 5f | friend |VBOOL __|
|00005470| 63 6d 66 20 6f 70 65 72 | 61 74 6f 72 21 3d 28 63 |cmf oper|ator!=(c|
|00005480| 6f 6d 70 6c 65 78 3c 66 | 6c 6f 61 74 3e 20 5f 56 |omplex<f|loat> _V|
|00005490| 46 41 52 43 20 26 2c 20 | 66 6c 6f 61 74 29 3b 0d |FARC &, |float);.|
|000054a0| 0a 0d 0a 20 20 20 20 20 | 20 20 2f 2f 20 20 43 6f |... | // Co|
|000054b0| 6d 70 6f 75 6e 64 2d 61 | 73 73 69 67 6e 6d 65 6e |mpound-a|ssignmen|
|000054c0| 74 20 6f 70 65 72 61 74 | 6f 72 73 3a 0d 0a 20 20 |t operat|ors:.. |
|000054d0| 20 20 63 6f 6d 70 6c 65 | 78 3c 66 6c 6f 61 74 3e | comple|x<float>|
|000054e0| 20 5f 56 46 41 52 20 26 | 20 5f 5f 63 6d 6f 20 20 | _VFAR &| __cmo |
|000054f0| 6f 70 65 72 61 74 6f 72 | 2b 3d 20 28 63 6f 6d 70 |operator|+= (comp|
|00005500| 6c 65 78 3c 66 6c 6f 61 | 74 3e 20 5f 56 46 41 52 |lex<floa|t> _VFAR|
|00005510| 43 20 26 29 3b 0d 0a 20 | 20 20 20 63 6f 6d 70 6c |C &);.. | compl|
|00005520| 65 78 3c 66 6c 6f 61 74 | 3e 20 5f 56 46 41 52 20 |ex<float|> _VFAR |
|00005530| 26 20 5f 5f 63 6d 6f 20 | 20 6f 70 65 72 61 74 6f |& __cmo | operato|
|00005540| 72 2d 3d 20 28 63 6f 6d | 70 6c 65 78 3c 66 6c 6f |r-= (com|plex<flo|
|00005550| 61 74 3e 20 5f 56 46 41 | 52 43 20 26 29 3b 0d 0a |at> _VFA|RC &);..|
|00005560| 20 20 20 20 63 6f 6d 70 | 6c 65 78 3c 66 6c 6f 61 | comp|lex<floa|
|00005570| 74 3e 20 5f 56 46 41 52 | 20 26 20 5f 5f 63 6d 6f |t> _VFAR| & __cmo|
|00005580| 20 20 6f 70 65 72 61 74 | 6f 72 2a 3d 20 28 63 6f | operat|or*= (co|
|00005590| 6d 70 6c 65 78 3c 66 6c | 6f 61 74 3e 20 5f 56 46 |mplex<fl|oat> _VF|
|000055a0| 41 52 43 20 26 29 3b 0d | 0a 20 20 20 20 63 6f 6d |ARC &);.|. com|
|000055b0| 70 6c 65 78 3c 66 6c 6f | 61 74 3e 20 5f 56 46 41 |plex<flo|at> _VFA|
|000055c0| 52 20 26 20 5f 5f 63 6d | 6f 20 20 6f 70 65 72 61 |R & __cm|o opera|
|000055d0| 74 6f 72 2f 3d 20 28 63 | 6f 6d 70 6c 65 78 3c 66 |tor/= (c|omplex<f|
|000055e0| 6c 6f 61 74 3e 20 5f 56 | 46 41 52 43 20 26 29 3b |loat> _V|FARC &);|
|000055f0| 0d 0a 0d 0a 20 20 20 20 | 63 6f 6d 70 6c 65 78 3c |.... |complex<|
|00005600| 66 6c 6f 61 74 3e 20 5f | 56 46 41 52 20 26 20 5f |float> _|VFAR & _|
|00005610| 5f 63 6d 6f 20 20 6f 70 | 65 72 61 74 6f 72 2b 3d |_cmo op|erator+=|
|00005620| 20 28 63 6f 6d 70 6c 65 | 78 3c 64 6f 75 62 6c 65 | (comple|x<double|
|00005630| 3e 20 5f 56 46 41 52 43 | 20 26 29 3b 0d 0a 20 20 |> _VFARC| &);.. |
|00005640| 20 20 63 6f 6d 70 6c 65 | 78 3c 66 6c 6f 61 74 3e | comple|x<float>|
|00005650| 20 5f 56 46 41 52 20 26 | 20 5f 5f 63 6d 6f 20 20 | _VFAR &| __cmo |
|00005660| 6f 70 65 72 61 74 6f 72 | 2d 3d 20 28 63 6f 6d 70 |operator|-= (comp|
|00005670| 6c 65 78 3c 64 6f 75 62 | 6c 65 3e 20 5f 56 46 41 |lex<doub|le> _VFA|
|00005680| 52 43 20 26 29 3b 0d 0a | 20 20 20 20 63 6f 6d 70 |RC &);..| comp|
|00005690| 6c 65 78 3c 66 6c 6f 61 | 74 3e 20 5f 56 46 41 52 |lex<floa|t> _VFAR|
|000056a0| 20 26 20 5f 5f 63 6d 6f | 20 20 6f 70 65 72 61 74 | & __cmo| operat|
|000056b0| 6f 72 2a 3d 20 28 63 6f | 6d 70 6c 65 78 3c 64 6f |or*= (co|mplex<do|
|000056c0| 75 62 6c 65 3e 20 5f 56 | 46 41 52 43 20 26 29 3b |uble> _V|FARC &);|
|000056d0| 0d 0a 20 20 20 20 63 6f | 6d 70 6c 65 78 3c 66 6c |.. co|mplex<fl|
|000056e0| 6f 61 74 3e 20 5f 56 46 | 41 52 20 26 20 5f 5f 63 |oat> _VF|AR & __c|
|000056f0| 6d 6f 20 20 6f 70 65 72 | 61 74 6f 72 2f 3d 20 28 |mo oper|ator/= (|
|00005700| 63 6f 6d 70 6c 65 78 3c | 64 6f 75 62 6c 65 3e 20 |complex<|double> |
|00005710| 5f 56 46 41 52 43 20 26 | 29 3b 0d 0a 0d 0a 20 20 |_VFARC &|);.... |
|00005720| 20 20 63 6f 6d 70 6c 65 | 78 3c 66 6c 6f 61 74 3e | comple|x<float>|
|00005730| 20 5f 56 46 41 52 20 26 | 20 5f 5f 63 6d 6f 20 20 | _VFAR &| __cmo |
|00005740| 6f 70 65 72 61 74 6f 72 | 2b 3d 20 28 63 6f 6d 70 |operator|+= (comp|
|00005750| 6c 65 78 3c 6c 6f 6e 67 | 20 64 6f 75 62 6c 65 3e |lex<long| double>|
|00005760| 20 5f 56 46 41 52 43 20 | 26 29 3b 0d 0a 20 20 20 | _VFARC |&);.. |
|00005770| 20 63 6f 6d 70 6c 65 78 | 3c 66 6c 6f 61 74 3e 20 | complex|<float> |
|00005780| 5f 56 46 41 52 20 26 20 | 5f 5f 63 6d 6f 20 20 6f |_VFAR & |__cmo o|
|00005790| 70 65 72 61 74 6f 72 2d | 3d 20 28 63 6f 6d 70 6c |perator-|= (compl|
|000057a0| 65 78 3c 6c 6f 6e 67 20 | 64 6f 75 62 6c 65 3e 20 |ex<long |double> |
|000057b0| 5f 56 46 41 52 43 20 26 | 29 3b 0d 0a 20 20 20 20 |_VFARC &|);.. |
|000057c0| 63 6f 6d 70 6c 65 78 3c | 66 6c 6f 61 74 3e 20 5f |complex<|float> _|
|000057d0| 56 46 41 52 20 26 20 5f | 5f 63 6d 6f 20 20 6f 70 |VFAR & _|_cmo op|
|000057e0| 65 72 61 74 6f 72 2a 3d | 20 28 63 6f 6d 70 6c 65 |erator*=| (comple|
|000057f0| 78 3c 6c 6f 6e 67 20 64 | 6f 75 62 6c 65 3e 20 5f |x<long d|ouble> _|
|00005800| 56 46 41 52 43 20 26 29 | 3b 0d 0a 20 20 20 20 63 |VFARC &)|;.. c|
|00005810| 6f 6d 70 6c 65 78 3c 66 | 6c 6f 61 74 3e 20 5f 56 |omplex<f|loat> _V|
|00005820| 46 41 52 20 26 20 5f 5f | 63 6d 6f 20 20 6f 70 65 |FAR & __|cmo ope|
|00005830| 72 61 74 6f 72 2f 3d 20 | 28 63 6f 6d 70 6c 65 78 |rator/= |(complex|
|00005840| 3c 6c 6f 6e 67 20 64 6f | 75 62 6c 65 3e 20 5f 56 |<long do|uble> _V|
|00005850| 46 41 52 43 20 26 29 3b | 0d 0a 0d 0a 20 20 20 20 |FARC &);|.... |
|00005860| 2f 2f 20 4f 76 65 72 6c | 6f 61 64 65 64 20 41 4e |// Overl|oaded AN|
|00005870| 53 49 20 43 20 6d 61 74 | 68 20 66 75 6e 63 74 69 |SI C mat|h functi|
|00005880| 6f 6e 73 0d 0a 20 20 20 | 20 66 72 69 65 6e 64 20 |ons.. | friend |
|00005890| 66 6c 6f 61 74 20 20 20 | 20 20 20 20 20 20 20 5f |float | _|
|000058a0| 5f 63 6d 66 20 61 62 73 | 28 63 6f 6d 70 6c 65 78 |_cmf abs|(complex|
|000058b0| 3c 66 6c 6f 61 74 3e 29 | 3b 0d 0a 20 20 20 20 66 |<float>)|;.. f|
|000058c0| 72 69 65 6e 64 20 63 6f | 6d 70 6c 65 78 3c 66 6c |riend co|mplex<fl|
|000058d0| 6f 61 74 3e 20 5f 5f 63 | 6d 66 20 61 63 6f 73 28 |oat> __c|mf acos(|
|000058e0| 63 6f 6d 70 6c 65 78 3c | 66 6c 6f 61 74 3e 29 3b |complex<|float>);|
|000058f0| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|00005900| 70 6c 65 78 3c 66 6c 6f | 61 74 3e 20 5f 5f 63 6d |plex<flo|at> __cm|
|00005910| 66 20 61 73 69 6e 28 63 | 6f 6d 70 6c 65 78 3c 66 |f asin(c|omplex<f|
|00005920| 6c 6f 61 74 3e 29 3b 0d | 0a 20 20 20 20 66 72 69 |loat>);.|. fri|
|00005930| 65 6e 64 20 63 6f 6d 70 | 6c 65 78 3c 66 6c 6f 61 |end comp|lex<floa|
|00005940| 74 3e 20 5f 5f 63 6d 66 | 20 61 74 61 6e 28 63 6f |t> __cmf| atan(co|
|00005950| 6d 70 6c 65 78 3c 66 6c | 6f 61 74 3e 29 3b 0d 0a |mplex<fl|oat>);..|
|00005960| 20 20 20 20 66 72 69 65 | 6e 64 20 63 6f 6d 70 6c | frie|nd compl|
|00005970| 65 78 3c 66 6c 6f 61 74 | 3e 20 5f 5f 63 6d 66 20 |ex<float|> __cmf |
|00005980| 63 6f 73 28 63 6f 6d 70 | 6c 65 78 3c 66 6c 6f 61 |cos(comp|lex<floa|
|00005990| 74 3e 29 3b 0d 0a 20 20 | 20 20 66 72 69 65 6e 64 |t>);.. | friend|
|000059a0| 20 63 6f 6d 70 6c 65 78 | 3c 66 6c 6f 61 74 3e 20 | complex|<float> |
|000059b0| 5f 5f 63 6d 66 20 63 6f | 73 68 28 63 6f 6d 70 6c |__cmf co|sh(compl|
|000059c0| 65 78 3c 66 6c 6f 61 74 | 3e 29 3b 0d 0a 20 20 20 |ex<float|>);.. |
|000059d0| 20 66 72 69 65 6e 64 20 | 63 6f 6d 70 6c 65 78 3c | friend |complex<|
|000059e0| 66 6c 6f 61 74 3e 20 5f | 5f 63 6d 66 20 63 75 62 |float> _|_cmf cub|
|000059f0| 69 63 28 63 6f 6d 70 6c | 65 78 3c 66 6c 6f 61 74 |ic(compl|ex<float|
|00005a00| 3e 29 3b 20 20 2f 2f 20 | 72 61 69 73 65 20 74 6f |>); // |raise to|
|00005a10| 20 74 68 65 20 74 68 69 | 72 64 20 70 6f 77 65 72 | the thi|rd power|
|00005a20| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|00005a30| 70 6c 65 78 3c 66 6c 6f | 61 74 3e 20 5f 5f 63 6d |plex<flo|at> __cm|
|00005a40| 66 20 65 78 70 28 63 6f | 6d 70 6c 65 78 3c 66 6c |f exp(co|mplex<fl|
|00005a50| 6f 61 74 3e 29 3b 0d 0a | 20 20 20 20 66 72 69 65 |oat>);..| frie|
|00005a60| 6e 64 20 63 6f 6d 70 6c | 65 78 3c 66 6c 6f 61 74 |nd compl|ex<float|
|00005a70| 3e 20 5f 5f 63 6d 66 20 | 69 6e 76 28 63 6f 6d 70 |> __cmf |inv(comp|
|00005a80| 6c 65 78 3c 66 6c 6f 61 | 74 3e 29 3b 20 20 20 20 |lex<floa|t>); |
|00005a90| 2f 2f 20 20 20 31 2e 30 | 20 2f 20 7a 0d 0a 20 20 |// 1.0| / z.. |
|00005aa0| 20 20 66 72 69 65 6e 64 | 20 63 6f 6d 70 6c 65 78 | friend| complex|
|00005ab0| 3c 66 6c 6f 61 74 3e 20 | 5f 5f 63 6d 66 20 69 70 |<float> |__cmf ip|
|00005ac0| 6f 77 28 63 6f 6d 70 6c | 65 78 3c 66 6c 6f 61 74 |ow(compl|ex<float|
|00005ad0| 3e 20 5f 5f 62 61 73 65 | 2c 20 69 6e 74 20 5f 5f |> __base|, int __|
|00005ae0| 65 78 70 6f 6e 29 3b 20 | 20 2f 2f 20 69 6e 74 65 |expon); | // inte|
|00005af0| 67 65 72 20 70 6f 77 65 | 72 0d 0a 20 20 20 20 66 |ger powe|r.. f|
|00005b00| 72 69 65 6e 64 20 63 6f | 6d 70 6c 65 78 3c 66 6c |riend co|mplex<fl|
|00005b10| 6f 61 74 3e 20 5f 5f 63 | 6d 66 20 6c 6e 28 63 6f |oat> __c|mf ln(co|
|00005b20| 6d 70 6c 65 78 3c 66 6c | 6f 61 74 3e 29 3b 0d 0a |mplex<fl|oat>);..|
|00005b30| 20 20 20 20 66 72 69 65 | 6e 64 20 63 6f 6d 70 6c | frie|nd compl|
|00005b40| 65 78 3c 66 6c 6f 61 74 | 3e 20 5f 5f 63 6d 66 20 |ex<float|> __cmf |
|00005b50| 6c 6f 67 28 63 6f 6d 70 | 6c 65 78 3c 66 6c 6f 61 |log(comp|lex<floa|
|00005b60| 74 3e 29 3b 20 2f 2f 20 | 73 61 6d 65 20 61 73 20 |t>); // |same as |
|00005b70| 6c 6e 0d 0a 20 20 20 20 | 66 72 69 65 6e 64 20 63 |ln.. |friend c|
|00005b80| 6f 6d 70 6c 65 78 3c 66 | 6c 6f 61 74 3e 20 5f 5f |omplex<f|loat> __|
|00005b90| 63 6d 66 20 6c 6f 67 32 | 28 63 6f 6d 70 6c 65 78 |cmf log2|(complex|
|00005ba0| 3c 66 6c 6f 61 74 3e 29 | 3b 0d 0a 20 20 20 20 66 |<float>)|;.. f|
|00005bb0| 72 69 65 6e 64 20 63 6f | 6d 70 6c 65 78 3c 66 6c |riend co|mplex<fl|
|00005bc0| 6f 61 74 3e 20 5f 5f 63 | 6d 66 20 6c 6f 67 31 30 |oat> __c|mf log10|
|00005bd0| 28 63 6f 6d 70 6c 65 78 | 3c 66 6c 6f 61 74 3e 29 |(complex|<float>)|
|00005be0| 3b 0d 0a 20 20 20 20 66 | 72 69 65 6e 64 20 63 6f |;.. f|riend co|
|00005bf0| 6d 70 6c 65 78 3c 66 6c | 6f 61 74 3e 20 5f 5f 63 |mplex<fl|oat> __c|
|00005c00| 6d 66 20 70 6f 77 28 63 | 6f 6d 70 6c 65 78 3c 66 |mf pow(c|omplex<f|
|00005c10| 6c 6f 61 74 3e 20 5f 5f | 62 61 73 65 2c 20 66 6c |loat> __|base, fl|
|00005c20| 6f 61 74 20 5f 5f 65 78 | 70 6f 6e 29 3b 0d 0a 20 |oat __ex|pon);.. |
|00005c30| 20 20 20 66 72 69 65 6e | 64 20 63 6f 6d 70 6c 65 | frien|d comple|
|00005c40| 78 3c 66 6c 6f 61 74 3e | 20 5f 5f 63 6d 66 20 70 |x<float>| __cmf p|
|00005c50| 6f 77 52 65 45 78 70 6f | 28 63 6f 6d 70 6c 65 78 |owReExpo|(complex|
|00005c60| 3c 66 6c 6f 61 74 3e 20 | 5f 5f 62 61 73 65 2c 20 |<float> |__base, |
|00005c70| 66 6c 6f 61 74 20 5f 5f | 65 78 70 6f 6e 29 3b 0d |float __|expon);.|
|00005c80| 0a 20 20 20 20 66 72 69 | 65 6e 64 20 63 6f 6d 70 |. fri|end comp|
|00005c90| 6c 65 78 3c 66 6c 6f 61 | 74 3e 20 5f 5f 63 6d 66 |lex<floa|t> __cmf|
|00005ca0| 20 70 6f 77 28 66 6c 6f | 61 74 20 5f 5f 62 61 73 | pow(flo|at __bas|
|00005cb0| 65 2c 20 63 6f 6d 70 6c | 65 78 3c 66 6c 6f 61 74 |e, compl|ex<float|
|00005cc0| 3e 20 5f 5f 65 78 70 6f | 6e 29 3b 0d 0a 20 20 20 |> __expo|n);.. |
|00005cd0| 20 66 72 69 65 6e 64 20 | 63 6f 6d 70 6c 65 78 3c | friend |complex<|
|00005ce0| 66 6c 6f 61 74 3e 20 5f | 5f 63 6d 66 20 70 6f 77 |float> _|_cmf pow|
|00005cf0| 52 65 42 61 73 65 28 66 | 6c 6f 61 74 20 5f 5f 62 |ReBase(f|loat __b|
|00005d00| 61 73 65 2c 20 63 6f 6d | 70 6c 65 78 3c 66 6c 6f |ase, com|plex<flo|
|00005d10| 61 74 3e 20 5f 5f 65 78 | 70 6f 6e 29 3b 0d 0a 20 |at> __ex|pon);.. |
|00005d20| 20 20 20 66 72 69 65 6e | 64 20 63 6f 6d 70 6c 65 | frien|d comple|
|00005d30| 78 3c 66 6c 6f 61 74 3e | 20 5f 5f 63 6d 66 20 70 |x<float>| __cmf p|
|00005d40| 6f 77 28 63 6f 6d 70 6c | 65 78 3c 66 6c 6f 61 74 |ow(compl|ex<float|
|00005d50| 3e 20 5f 5f 62 61 73 65 | 2c 20 63 6f 6d 70 6c 65 |> __base|, comple|
|00005d60| 78 3c 66 6c 6f 61 74 3e | 20 5f 5f 65 78 70 6f 6e |x<float>| __expon|
|00005d70| 29 3b 0d 0a 20 20 20 20 | 66 72 69 65 6e 64 20 63 |);.. |friend c|
|00005d80| 6f 6d 70 6c 65 78 3c 66 | 6c 6f 61 74 3e 20 5f 5f |omplex<f|loat> __|
|00005d90| 63 6d 66 20 71 75 61 72 | 74 69 63 28 63 6f 6d 70 |cmf quar|tic(comp|
|00005da0| 6c 65 78 3c 66 6c 6f 61 | 74 3e 29 3b 20 20 2f 2f |lex<floa|t>); //|
|00005db0| 20 72 61 69 73 65 20 74 | 6f 20 74 68 65 20 66 6f | raise t|o the fo|
|00005dc0| 75 72 74 68 20 70 6f 77 | 65 72 0d 0a 20 20 20 20 |urth pow|er.. |
|00005dd0| 66 72 69 65 6e 64 20 63 | 6f 6d 70 6c 65 78 3c 66 |friend c|omplex<f|
|00005de0| 6c 6f 61 74 3e 20 5f 5f | 63 6d 66 20 73 69 6e 28 |loat> __|cmf sin(|
|00005df0| 63 6f 6d 70 6c 65 78 3c | 66 6c 6f 61 74 3e 29 3b |complex<|float>);|
|00005e00| 0d 0a 20 20 20 20 66 72 | 69 65 6e 64 20 63 6f 6d |.. fr|iend com|
|00005e10| 70 6c 65 78 3c 66 6c 6f | 61 74 3e 20 5f 5f 63 6d |plex<flo|at> __cm|
|00005e20| 66 20 73 69 6e 68 28 63 | 6f 6d 70 6c 65 78 3c 66 |f sinh(c|omplex<f|
|00005e30| 6c 6f 61 74 3e 29 3b 0d | 0a 20 20 20 20 66 72 69 |loat>);.|. fri|
|00005e40| 65 6e 64 20 63 6f 6d 70 | 6c 65 78 3c 66 6c 6f 61 |end comp|lex<floa|
|00005e50| 74 3e 20 5f 5f 63 6d 66 | 20 73 71 72 74 28 63 6f |t> __cmf| sqrt(co|
|00005e60| 6d 70 6c 65 78 3c 66 6c | 6f 61 74 3e 29 3b 0d 0a |mplex<fl|oat>);..|
|00005e70| 20 20 20 20 66 72 69 65 | 6e 64 20 63 6f 6d 70 6c | frie|nd compl|
|00005e80| 65 78 3c 66 6c 6f 61 74 | 3e 20 5f 5f 63 6d 66 20 |ex<float|> __cmf |
|00005e90| 73 71 75 61 72 65 28 63 | 6f 6d 70 6c 65 78 3c 66 |square(c|omplex<f|
|00005ea0| 6c 6f 61 74 3e 29 3b 0d | 0a 20 20 20 20 66 72 69 |loat>);.|. fri|
|00005eb0| 65 6e 64 20 63 6f 6d 70 | 6c 65 78 3c 66 6c 6f 61 |end comp|lex<floa|
|00005ec0| 74 3e 20 5f 5f 63 6d 66 | 20 74 61 6e 28 63 6f 6d |t> __cmf| tan(com|
|00005ed0| 70 6c 65 78 3c 66 6c 6f | 61 74 3e 29 3b 0d 0a 20 |plex<flo|at>);.. |
|00005ee0| 20 20 20 66 72 69 65 6e | 64 20 63 6f 6d 70 6c 65 | frien|d comple|
|00005ef0| 78 3c 66 6c 6f 61 74 3e | 20 5f 5f 63 6d 66 20 74 |x<float>| __cmf t|
|00005f00| 61 6e 68 28 63 6f 6d 70 | 6c 65 78 3c 66 6c 6f 61 |anh(comp|lex<floa|
|00005f10| 74 3e 29 3b 0d 0a 0d 0a | 20 20 20 20 66 72 69 65 |t>);....| frie|
|00005f20| 6e 64 20 69 73 74 72 65 | 61 6d 20 5f 56 46 41 52 |nd istre|am _VFAR|
|00005f30| 20 26 20 5f 5f 63 6d 66 | 20 6f 70 65 72 61 74 6f | & __cmf| operato|
|00005f40| 72 3e 3e 20 28 69 73 74 | 72 65 61 6d 20 5f 56 46 |r>> (ist|ream _VF|
|00005f50| 41 52 20 26 2c 20 63 6f | 6d 70 6c 65 78 3c 66 6c |AR &, co|mplex<fl|
|00005f60| 6f 61 74 3e 20 5f 56 46 | 41 52 20 26 29 3b 0d 0a |oat> _VF|AR &);..|
|00005f70| 20 20 20 20 66 72 69 65 | 6e 64 20 6f 73 74 72 65 | frie|nd ostre|
|00005f80| 61 6d 20 5f 56 46 41 52 | 20 26 20 5f 5f 63 6d 66 |am _VFAR| & __cmf|
|00005f90| 20 6f 70 65 72 61 74 6f | 72 3c 3c 20 28 6f 73 74 | operato|r<< (ost|
|00005fa0| 72 65 61 6d 20 5f 56 46 | 41 52 20 26 2c 20 63 6f |ream _VF|AR &, co|
|00005fb0| 6d 70 6c 65 78 3c 66 6c | 6f 61 74 3e 20 5f 56 46 |mplex<fl|oat> _VF|
|00005fc0| 41 52 43 20 26 29 3b 0d | 0a 0d 0a 20 20 20 20 66 |ARC &);.|... f|
|00005fd0| 6c 6f 61 74 20 52 65 2c | 20 49 6d 3b 20 20 2f 2f |loat Re,| Im; //|
|00005fe0| 20 73 74 69 6c 6c 20 70 | 75 62 6c 69 63 21 0d 0a | still p|ublic!..|
|00005ff0| 7d 3b 0d 0a 0d 0a 63 6c | 61 73 73 20 20 63 6f 6d |};....cl|ass com|
|00006000| 70 6c 65 78 3c 64 6f 75 | 62 6c 65 3e 0d 0a 7b 0d |plex<dou|ble>..{.|
|00006010| 0a 20 20 70 75 62 6c 69 | 63 3a 0d 0a 20 20 20 20 |. publi|c:.. |
|00006020| 20 20 20 20 20 2f 2f 20 | 63 6f 6e 73 74 72 75 63 | // |construc|
|00006030| 74 6f 72 73 3a 0d 0a 20 | 20 20 20 23 69 66 20 64 |tors:.. | #if d|
|00006040| 65 66 69 6e 65 64 20 5f | 5f 42 4f 52 4c 41 4e 44 |efined _|_BORLAND|
|00006050| 43 5f 5f 20 26 26 20 5f | 5f 42 4f 52 4c 41 4e 44 |C__ && _|_BORLAND|
|00006060| 43 5f 5f 20 3e 3d 20 30 | 78 34 35 30 0d 0a 20 20 |C__ >= 0|x450.. |
|00006070| 20 20 20 20 20 20 63 6f | 6d 70 6c 65 78 28 20 64 | co|mplex( d|
|00006080| 6f 75 62 6c 65 20 52 65 | 5f 70 61 72 74 2c 20 64 |ouble Re|_part, d|
|00006090| 6f 75 62 6c 65 20 49 6d | 5f 70 61 72 74 20 29 20 |ouble Im|_part ) |
|000060a0| 7b 52 65 3d 52 65 5f 70 | 61 72 74 3b 20 49 6d 3d |{Re=Re_p|art; Im=|
|000060b0| 49 6d 5f 70 61 72 74 3b | 7d 0d 0a 20 20 20 20 20 |Im_part;|}.. |
|000060c0| 20 20 20 63 6f 6d 70 6c | 65 78 28 20 64 6f 75 62 | compl|ex( doub|
|000060d0| 6c 65 20 52 65 5f 70 61 | 72 74 20 29 20 20 7b 52 |le Re_pa|rt ) {R|
|000060e0| 65 3d 52 65 5f 70 61 72 | 74 3b 20 49 6d 3d 30 3b |e=Re_par|t; Im=0;|
|000060f0| 7d 0d 0a 20 20 20 20 20 | 20 20 20 63 6f 6d 70 6c |}.. | compl|
|00006100| 65 78 28 29 20 7b 7d 3b | 0d 0a 20 20 20 20 20 20 |ex() {};|.. |
|00006110| 20 20 20 20 20 20 2f 2f | 20 69 6e 74 65 72 63 6f | //| interco|
|00006120| 6e 76 65 72 73 69 6f 6e | 73 20 62 65 74 77 65 65 |nversion|s betwee|
|00006130| 6e 20 74 68 65 20 74 68 | 72 65 65 20 6c 65 76 65 |n the th|ree leve|
|00006140| 6c 73 20 6f 66 20 61 63 | 63 75 72 61 63 79 3a 0d |ls of ac|curacy:.|
|00006150| 0a 20 20 20 20 20 20 20 | 20 20 20 20 20 2f 2f 20 |. | // |
|00006160| 77 69 74 68 20 4f 56 45 | 52 46 4c 4f 57 20 65 72 |with OVE|RFLOW er|
|00006170| 72 6f 72 20 68 61 6e 64 | 6c 69 6e 67 20 66 6f 72 |ror hand|ling for|
|00006180| 20 74 68 65 20 64 6f 77 | 6e 2d 63 6f 6e 76 65 72 | the dow|n-conver|
|00006190| 73 69 6f 6e 73 0d 0a 20 | 20 20 20 20 20 20 20 63 |sions.. | c|
|000061a0| 6f 6d 70 6c 65 78 20 28 | 63 6f 6d 70 6c 65 78 3c |omplex (|complex<|
|000061b0| 66 6c 6f 61 74 3e 20 5f | 56 46 41 52 43 20 26 29 |float> _|VFARC &)|
|000061c0| 3b 0d 0a 20 20 20 20 23 | 65 6c 73 65 20 2f 2f 20 |;.. #|else // |
|000061d0| 70 72 6f 62 6c 65 6d 73 | 20 77 69 74 68 20 74 68 |problems| with th|
|000061e0| 65 20 74 65 6d 70 6c 61 | 74 65 20 64 65 66 69 6e |e templa|te defin|
|000061f0| 69 74 69 6f 6e 73 20 69 | 6e 20 6f 6c 64 65 72 20 |itions i|n older |
|00006200| 76 65 72 73 69 6f 6e 73 | 0d 0a 09 09 20 20 63 6f |versions|.... co|
|00006210| 6d 70 6c 65 78 3c 64 6f | 75 62 6c 65 3e 28 20 64 |mplex<do|uble>( d|
|00006220| 6f 75 62 6c 65 20 52 65 | 5f 70 61 72 74 2c 20 64 |ouble Re|_part, d|
|00006230| 6f 75 62 6c 65 20 49 6d | 5f 70 61 72 74 20 29 20 |ouble Im|_part ) |
|00006240| 7b 52 65 3d 52 65 5f 70 | 61 72 74 3b 20 49 6d 3d |{Re=Re_p|art; Im=|
|00006250| 49 6d 5f 70 61 72 74 3b | 7d 0d 0a 09 09 20 20 63 |Im_part;|}.... c|
|00006260| 6f 6d 70 6c 65 78 3c 64 | 6f 75 62 6c 65 3e 28 20 |omplex<d|ouble>( |
|00006270| 64 6f 75 62 6c 65 20 52 | 65 5f 70 61 72 74 20 29 |double R|e_part )|
|00006280| 20 20 7b 52 65 3d 52 65 | 5f 70 61 72 74 3b 20 49 | {Re=Re|_part; I|
|00006290| 6d 3d 30 3b 7d 0d 0a 09 | 09 20 20 63 6f 6d 70 6c |m=0;}...|. compl|
|000062a0| 65 78 3c 64 6f 75 62 6c | 65 3e 28 29 20 7b 7d 3b |ex<doubl|e>() {};|
|000062b0| 0d 0a 09 09 20 20 63 6f | 6d 70 6c 65 78 3c 64 6f |.... co|mplex<do|
|000062c0| 75 62 6c 65 3e 20 28 63 | 6f 6d 70 6c 65 78 3c 66 |uble> (c|omplex<f|
|000062d0| 6c 6f 61 74 3e 20 5f 56 | 46 41 52 43 20 26 29 3b |loat> _V|FARC &);|
|000062e0| 0d 0a 20 20 20 20 23 65 | 6e 64 69 66 0d 0a 20 20 |.. #e|ndif.. |
|000062f0| 20 20 23 69 66 20 21 64 | 65 66 69 6e 65 64 20 5f | #if !d|efined _|
|00006300| 5f 42 4f 52 4c 41 4e 44 | 43 5f 5f 20 7c 7c 20 5f |_BORLAND|C__ || _|
|00006310| 5f 42 4f 52 4c 41 4e 44 | 43 5f 5f 20 3e 20 30 78 |_BORLAND|C__ > 0x|
|00006320| 35 30 30 0d 0a 20 20 20 | 20 20 20 20 20 63 6f 6d |500.. | com|
|00006330| 70 6c 65 78 3c 64 6f 75 | 62 6c 65 3e 20 28 63 6f |plex<dou|ble> (co|
|00006340| 6d 70 6c 65 78 3c 64 6f | 75 62 6c 65 3e 20 5f 56 |mplex<do|uble> _V|
|00006350| 46 41 52 43 20 26 29 3b | 0d 0a 20 20 20 20 23 65 |FARC &);|.. #e|
|00006360| 6e 64 69 66 0d 0a 20 20 | 20 20 23 69 66 20 64 65 |ndif.. | #if de|
|00006370| 66 69 6e 65 64 20 5f 5f | 42 4f 52 4c 41 4e 44 43 |fined __|BORLANDC|
|00006380| 5f 5f 20 26 26 20 5f 5f | 42 4f 52 4c 41 4e 44 43 |__ && __|BORLANDC|
|00006390| 5f 5f 20 3e 3d 20 30 78 | 35 30 30 0d 0a 20 20 20 |__ >= 0x|500.. |
|000063a0| 20 20 20 20 20 65 78 70 | 6c 69 63 69 74 20 63 6f | exp|licit co|
|000063b0| 6d 70 6c 65 78 20 28 63 | 6f 6d 70 6c 65 78 3c 6c |mplex (c|omplex<l|
|000063c0| 6f 6e 67 20 64 6f 75 62 | 6c 65 3e 20 5f 56 46 41 |ong doub|le> _VFA|
|000063d0| 52 43 20 26 29 3b 0d 0a | 20 20 20 20 23 65 6c 73 |RC &);..| #els|
|000063e0| 65 0d 0a 20 20 20 20 20 | 20 20 20 63 6f 6d 70 6c |e.. | compl|
|000063f0| 65 78 3c 64 6f 75 62 6c | 65 3e 20 28 63 6f 6d 70 |ex<doubl|e> (comp|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.